[PyQt] Processing signals from a called method while the method executes

alan moore me at alandmoore.com
Fri Jul 2 03:35:44 BST 2010


I've encountered this problem twice now in subtle ways, I think this is 
at the root of my last question about the QWebView; I've included sample 
code this time to illustrate.

In the attached script, I have a widget class and a processor class. 
The processor represents some kind of processing engine that's going to 
do a lengthy multi-part routine of some kind.  The widget class is the 
gui for the engine.

The "go" button is connected to the "process" method of the processor 
object.  The process() method emits a signal with a string, does process 
A for 10 seconds, emits a signal with a string, does process B for 10 
seconds, and emits a final signal with a string.

The widget class is supposed to be picking up the signals and displaying 
the strings. So the expected output is:

<click "go">
first message displays
<wait 10 seconds>
second message displays
<wait 10 seconds>
final message displays

The actual output is that nothing happens for 20 seconds, then all the 
text displays.  Because the widget isn't going to process any received 
signals until the called method exits.

How do I produce the expected behavior here?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt-frustration-example.py
Type: text/x-python
Size: 1165 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100701/4c41f7fc/attachment.py>


More information about the PyQt mailing list