diff --git a/libs/main.py b/libs/main.py index a0b5200..9f379c5 100644 --- a/libs/main.py +++ b/libs/main.py @@ -3,7 +3,7 @@ writen by shenjackyuanjie mail: 3695888@qq.com """ -from libs import Game_threads +from libs.Game_threads import orbit_demo import libs import pyglet import threading diff --git a/libs/render_thread.py b/libs/render_thread.py index ce2181a..070dfcf 100644 --- a/libs/render_thread.py +++ b/libs/render_thread.py @@ -7,9 +7,7 @@ import libs import pyglet import threading -from threading import Thread - -from pyglet.app import run +import pyglet.app from pyglet.window import Window from pyglet.resource import image @@ -31,7 +29,7 @@ class RenderThread(threading.Thread, pyglet.window.Window): # list def start_game(self): - run() + pyglet.app.run() return def setup(self): diff --git a/test.py b/test.py index 2d10f98..55d190e 100644 --- a/test.py +++ b/test.py @@ -32,4 +32,4 @@ f = libs.P_C.S_N_M(A,libs.P_C.S_N_M(B,libs.P_C.S_N_M(C, D))) print("A * B * C * D = " , e) print("A * B * C * D = " , f) -G = libs.render \ No newline at end of file +G = libs.render_thread \ No newline at end of file diff --git a/test_mutiproser.py b/test_mutiproser.py new file mode 100644 index 0000000..4343a9c --- /dev/null +++ b/test_mutiproser.py @@ -0,0 +1,41 @@ + +import multiprocessing as mp +import os, time + +class Main(): + def __init__(self, dev) -> None: + self.aaa = 1 + self.ttt = False + self.dev = dev + + def main(self): + while self.ttt: + print(time.time()) + print(os.getpid()) + time.sleep(0.5) + while not(self.dev.using): + self.dev.using = True + if self.dev.bget == True: + print("B 没拿到") + else: + print("B 拿到了") + self.dev.aget = True + self.dev.using = False + + +class render(): + def __init__(self, dev) -> None: + self.bbb = 3 + self.ggg = True + + +class Delivery(): + def __init__(self) -> None: + self.using = False + self.dev1 = "" + self.aget = False + self.bget = False + + +if __name__ == "__main__": + dev = Delivery()