-
Notifications
You must be signed in to change notification settings - Fork 0
/
record.py
50 lines (34 loc) · 844 Bytes
/
record.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
45
46
47
48
49
50
import pygame
wind = (600,100)
display = pygame.display.set_mode(wind)
clock = pygame.time.Clock()
color = [(255,0,0),(0,255,0)]
ind = 0
width = 0
rec = False
buffer = []
co = 0
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
break
if event.type == pygame.MOUSEMOTION:
print(buffer)
width = event.pos[0]
if event.type == pygame.MOUSEBUTTONDOWN:
rec = True
ind = 1
buffer = []
if co == 35:
rec = False
co = 0
ind = 0
print(buffer)
display.fill((0, 0, 255))
pygame.draw.rect(display, color[ind], (0, 0, width, 100))
if rec:
co += 1
buffer.append(width)
pygame.display.flip()
clock.tick(5)