-
Notifications
You must be signed in to change notification settings - Fork 0
/
starter.py
44 lines (32 loc) · 970 Bytes
/
starter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pygame
pygame.init()
screen = pygame.display.set_mode((1200,700))
pygame.display.set_caption("Kmeans visualization")
running = True
clock = pygame.time.Clock()
BACKGROUND = (214, 214, 214)
BLACK = (0, 0, 0)
BACKGROUND_PANEL = (249, 255, 230)
WHITE = (255, 255 ,255)
font = pygame.font.SysFont('sans', 40)
text_plus = font.render('+', True, WHITE)
while running:
clock.tick(60)
screen.fill(BACKGROUND)
# Draw interface
# Draw panel
pygame.draw.rect(screen, BLACK, (50,50,700,500))
pygame.draw.rect(screen, BACKGROUND_PANEL, (55,55,690,490))
# K button +
pygame.draw.rect(screen, BLACK, (850,50,50,50))
screen.blit(text_plus, (860,50,50,50))
# End draw interface
mouse_x, mouse_y = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
if 850 < mouse_x < 900 and 50 < mouse_y < 100 :
print("Press +")
pygame.display.flip()
pygame.quit()