_
This commit is contained in:
parent
57863eb08a
commit
24ce2842ae
26
UI/App.py
Normal file
26
UI/App.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from multiprocessing import Queue
|
||||||
|
from multiprocessing import Process
|
||||||
|
import pygame
|
||||||
|
from pygame.locals import *
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
class App:
|
||||||
|
def __init__(self, scene, edu, hands_ai):
|
||||||
|
self.scene = scene
|
||||||
|
self.edu = edu
|
||||||
|
self.hands_ai = hands_ai
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
q = Queue()
|
||||||
|
|
||||||
|
hands_ai_process = Process(target=self.hands_ai.run, args=(q,))
|
||||||
|
|
||||||
|
while True:
|
||||||
|
self.scene.redraw()
|
||||||
|
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == QUIT:
|
||||||
|
hands_ai_process.terminate()
|
||||||
|
pygame.quit()
|
||||||
|
sys.exit(0)
|
@ -15,4 +15,3 @@ class BasicScene(Scene):
|
|||||||
|
|
||||||
r0 = Rect(a([0, 0]), a([200, 200]), (160, 160, 160), self)
|
r0 = Rect(a([0, 0]), a([200, 200]), (160, 160, 160), self)
|
||||||
self.r_objects.append(r0)
|
self.r_objects.append(r0)
|
||||||
|
|
||||||
|
@ -8,4 +8,4 @@ scene = BasicScene(10, [600, 400])
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
scene.redraw()
|
scene.redraw()
|
||||||
time.sleep(0.1)
|
time.sleep(0.01)
|
||||||
|
Loading…
Reference in New Issue
Block a user