I have a QtGui.QTabBar object that I use in my application. User interaction can open (or close) additional tabs to run various python modules. I’d like to make each of these run in their own process to ensure that longer running/CPU intensive modules don’t block simple ones.
There does not need to be interaction between tabs. The only thing that would be needed is a way for the parent (existing) application to know when a tab closes and ensure the child process terminated correctly. I’m planning on using Pythons multiprocessing module to handle this.
Is there a way to make a new tab in a QTabBar open a separate process? If so, how? I’ve Google’d for ‘qtabbar separate processes‘ and similar, but I haven’t found anything that tells me one way or another if this is possible.
I’m using Python 2.7.3, PyQt and Qt 4.9
You can’t have a tab running in a new process. Any tab is just a widget, and all GUI is running in the main application thread.
But you can separate GUI from the business logic of your application.
For a single tab you can have a widget itself and a controller that can run in another thread and process your heavy calculations. Then you can connect your tab and its controller with signals/slots mechanism.