Do you processing function in C++, in a QThread or QRunnable.
Have Python start the execution of that function in compiled code.
At the end of processing have it signal the results to the main thread.
 
This means moving your work funtion into C++, and probably translating between Qt and python types (Shiboken should automate this I think?)
 
 
To clarify the original objective:
 
Given that:
A) python threads can not execute simultaneously due to the GIL (unless one thread releases the GIL, which does not appear to be the case in my code, or perhaps due to something with PySide), AND
B) my code does not lend itself to using multiprocessing rather than threading due to the large data structures involved (thus the reason the calculations take a while) -
 
How can I keep the GUI responsive while the calculations proceed?
 
So far the only solution I have come up with is to periodically call QApplication.processEvents() on the main thread from within my calculation code, but that is ugly and, according to everything I see online, indicative of a bad design. As I don’t want a bad design, what is the alternative? Or is this simply one of the rare cases where that *is* the correct answer?
 
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to