2021-09-01 11:56:26 +02:00
|
|
|
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,))
|
2021-09-01 17:32:53 +02:00
|
|
|
hands_ai_process.start()
|
2021-09-01 11:56:26 +02:00
|
|
|
|
|
|
|
while True:
|
2021-09-02 22:25:45 +02:00
|
|
|
self.scene.update()
|
2021-09-01 11:56:26 +02:00
|
|
|
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == QUIT:
|
|
|
|
hands_ai_process.terminate()
|
|
|
|
pygame.quit()
|
|
|
|
sys.exit(0)
|