I'm developing a Python project for dealing with computer simulations, and I'm also developing a GUI for it. (The core logic itself does not require a GUI.) The GUI toolkit I use for is wxPython, but I think my question is general enough not to depend on it.
The way that the GUI currently works is that it starts the core logic package (called garlicsim
) on the same process and the same thread as the GUI. This works, but I understand it's a problematic approach, because if the core logic needs to do some hard computation, the GUI will hang, which I consider unacceptable.
What should I do?
I heard about the option of launching the core logic on a separate process from the GUI. This sounds interesting, but I have a lot of questions about this.
- Do I use the
multiprocessing
package or thesubprocess
package to launch the new process? - How do I have easy access to the simulation data from the GUI process? After all, it will be stored on the other process. The user should be able to browse through the timeline of the simulation easily and smoothly. How can this be done?