I have a GUI and, by the click of a button I have to start a big calculation.
I am using QtDesigner with python 2.7
At the beginning, I had the problem that my GUI became unresponsive while the big calculation was working.
I solved this using the Threading module:
class myMainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
#rest of the code here
class heavyCalculations(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
#rest of the code here
My doubt now is: Let's say that I want to start 4 heavy calculations, and I want to use all 4 cores of my computer working on time. For that I will need multiprocessing, but what should I do to avoid my GUI to become unresponsive, but at the same time to use 4 cores on time?
As far as I know, If I start a new process for each heavy calculation it works in parallel indeed, but my GUI becomes unresponsive.
And if I start 4 threads, it also works and the GUI is not affected, but this is not real parallel.
Any help?