Skip to content Skip to sidebar Skip to footer

How Do I Tell My Main GUI To Wait On A Worker Thread?

I have successfully outsourced an expensive routine in my PyQT4 GUI to a worker QThread to prevent the GUI from going unresponsive. However, I would like the GUI to wait until the

Solution 1:

This is a really bad plan. Split up the 'before thread action' and 'after thread action'. The 'after thread action' should be a slot fired by a QueuedConnection that the thread can signal.

Do not wait in GUI event handlers!


Solution 2:

If the GUI thread called the wait() function on the worker thread object, it would not return from it until the worker thread returns from its main function. This is not what you want to do.

The solution you describe using signal and slots seems to make plenty of sense to me. Or you could just use a boolean.


Post a Comment for "How Do I Tell My Main GUI To Wait On A Worker Thread?"