-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainThread.py
More file actions
30 lines (22 loc) · 741 Bytes
/
mainThread.py
File metadata and controls
30 lines (22 loc) · 741 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
import pygame as py
import asyncio
import colors
class MainThread():
def __init__(self, actions, py):
self.actions = actions
self.running = 1
self.py = py
def startStopRunning(self):
self.running = not self.running
def addActions(self, action):
self.actions.append(action)
def deleteAction(self, action):
self.actions.pop(self.actions.index(action))
def mainThread(self):
while self.running:
for evento in self.py.event.get():
if evento.type == self.py.QUIT:
self.startStopRunning
self.py.quit()
for x in self.actions:
x[0](*x[1])