You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use multiprocessing to coordinate Tkinter with Pygame. Here GUI is created by Tkinter as the father process. When users start the simulation, GUI creates a son process of pygame and GUI process is suspended. After pygame exits, GUI process is free to run again, and users can set up another simulation and then start another simulation run.
In other words, there is one token to coordinate two processes. When the son process of pygame is created, the token is automatically given to pygame. When pygame process is closed by users, the token is returned to father process of Tkinter.
One problem is that I found I do not have to use .join() in multiprocessing after the pygame process terminates. The whole program runs more smoothly if I do not use .join() in multiprocessing and I do not know why. I will keep exploring this topic.
def startSim(self):
self.currentSimu = simulation()
self.currentSimu.select_file(self.fname_EVAC, self.fname_FDS, "non-gui")
#self.textInformation.insert(END, "Start Simulation Now!")
self.setStatusStr("Simulation starts! GUI window is not effective when Pygame screen is displayed!")
self.updateCtrlParam()
self.currentSimu.preprocessGeom()
self.currentSimu.preprocessAgent()
sunpro1 = mp.Process(target=show_simu(self.currentSimu)) # Pygame starts here
sunpro1.start()
#sunpro1.join()
self.setStatusStr("Simulation not yet started!")
self.currentSimu.quit()
The text was updated successfully, but these errors were encountered:
I am trying to use multiprocessing to coordinate Tkinter with Pygame. Here GUI is created by Tkinter as the father process. When users start the simulation, GUI creates a son process of pygame and GUI process is suspended. After pygame exits, GUI process is free to run again, and users can set up another simulation and then start another simulation run.
In other words, there is one token to coordinate two processes. When the son process of pygame is created, the token is automatically given to pygame. When pygame process is closed by users, the token is returned to father process of Tkinter.
One problem is that I found I do not have to use .join() in multiprocessing after the pygame process terminates. The whole program runs more smoothly if I do not use .join() in multiprocessing and I do not know why. I will keep exploring this topic.
The text was updated successfully, but these errors were encountered: