-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
95 lines (75 loc) · 2.58 KB
/
Copy pathmain.py
File metadata and controls
95 lines (75 loc) · 2.58 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import pygame, sys, time, random
from pygame.locals import *
from threading import Thread
from pynput.keyboard import Key, Listener
def work(x,a,key):
global bg_color, keys
keys.remove(key)
for i in range(20):
time.sleep(0.002)
pygame.draw.circle(SURFACE,a,(x,200),i*8)
#pygame.display.update()
for i in range(20):
time.sleep(0.002)
pygame.draw.circle(SURFACE,bg_color,(x,200),152-(i*8)+10)
pygame.draw.circle(SURFACE,a,(x,200),152-(i*8))
#pygame.display.update()
def random_color():
return (random.randint(20,255),random.randint(20,255),random.randint(20,255))
colora, colors, colord, colorf,colorh, colorj, colork, colorl, bg_color= (0,0,0), (0,0,0),(0,0,0),(0,0,0),(0,0,0),(0,0,0),(0,0,0),(0,0,0),(0,0,0)
keys = []
pygame.init()
SURFACE = pygame.display.set_mode((1800,400))
pygame.display.set_caption("내가 왜 이걸 만들고 있는건지도 모르겠는 그런 프로그램")
FPSCLOCK = pygame.time.Clock()
sysfont=pygame.font.SysFont(None, 70)
while True:
tha = Thread(target=work, args=(200,colora, 97))
ths = Thread(target=work, args=(400,colors, K_s))
thd = Thread(target=work, args=(600,colord, K_d))
thf = Thread(target=work, args=(800,colorf, K_f))
thh = Thread(target=work, args=(1000,colorh, K_g))
thj = Thread(target=work, args=(1200,colorj, K_h))
thk = Thread(target=work, args=(1400,colork, K_j))
thl = Thread(target=work, args=(1600,colorl, K_k))
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
if event.key == K_SPACE:
bg_color = random_color()
SURFACE.fill(bg_color)
pygame.display.update()
time.sleep(0.09)
keys.append(event.key)
if event.type == KEYUP:
try:
keys.remove(event.key)
except:
pass
if 97 in keys:
colora = random_color()
tha.start()
elif 115 in keys:
colors = random_color()
ths.start()
elif 100 in keys:
colord = random_color()
thd.start()
elif 102 in keys:
colorf = random_color()
thf.start()
elif K_g in keys:
colorh = random_color()
thh.start()
elif K_h in keys:
colorj = random_color()
thj.start()
elif K_j in keys:
colork = random_color()
thk.start()
elif K_k in keys:
colorl = random_color()
thl.start()
pygame.display.update()