-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw.py
More file actions
57 lines (39 loc) · 1.01 KB
/
draw.py
File metadata and controls
57 lines (39 loc) · 1.01 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
import pygame
from tree import node
"""
Make nodes to display
"""
n1 = node()
"""
Pygame setup
"""
pygame.init()
#Screen size
x = 1280
y = 720
screen = pygame.display.set_mode((x, y))
#Uvisst om jeg trenger klokke for å displaye en gang
clock = pygame.time.Clock()
#samme med denne
running = True
#font for text
font = pygame.font.Font('freesansbold.ttf', 12)
text = font.render(str(n1.value), True, "black", None)
#get rectangle for text surface
textRect = text.get_rect()
# set center of rect to center of circle
textRect.center = (10, 10)
while running:
# poll for events
# pygame.QUIT event means the user clicked X to close your window
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
#fill screen to wipe
screen.fill("white")
# DRAW TREE
circ = pygame.draw.circle(screen, "black", (10, 10), 10, 2)
screen.blit(text, textRect)
pygame.display.flip()
clock.tick(1) #only need to draw once so make this very low
pygame.quit()