-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass work.py
More file actions
46 lines (35 loc) · 931 Bytes
/
Class work.py
File metadata and controls
46 lines (35 loc) · 931 Bytes
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
import pygame, random
BLACK = (0,0,0)
WHITE = (255, 255, 255)
pygame.init()
size = (700,500)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Mygame")
done = False
click = False
Rcount = 0
Rlimit = 50
def RandomColor():
R = random.randint(0,255)
G = random.randint(0,255)
B = random.randint(0,255)
return (R,G,B)
clock = pygame.time.Clock()
while not done:
for event in pygame.event.get():
if event.type==pygame.QUIT:
done = True
if event.type== pygame.MOUSEBUTTONDOWN:
pos = pygame.mouse.get_pos()
click = True
Rcount = 0
Color = RandomColor()
screen.fill(BLACK)
if click and Rcount < Rlimit:
pygame.draw.circle(screen, Color, pos, Rcount)
pygame.display.flip()
Rcount +=1
if Rcount >= Rlimit:
click = False
clock.tick(60)
pygame.quit()