[PyKDE] Correct cross-thread communication example?

Paul Giannaros ceruleanblaze at gmail.com
Sun Jan 7 15:02:09 GMT 2007


I've been trying to get the main GUI thread to pass a URL to a worker thread 
and have it download that (without the GUI thread blocking). I haven't been 
able to do it successfully, i've tried all manner of connects/postEvents.
Here is a simplified example:

http://rafb.net/p/etOoSH97.html

In the example i'm trying to get the main thread to cause the MyThread 
instance to sleep without blocking the main thread. In MyThread.run I call 
MyThread.foo (which blocks for 5 seconds) without a problem - the GUI thread 
isn't being blocked. When I try to get the main thread to indirectly invoke 
foo (via emitting a signal that the thread listens for, or by posting an 
event that MyThread picks up in customEvent), then the GUI thread blocks.

It's quite crippling. What's the correct way to go about this? 

Thanks,
Paul




More information about the PyQt mailing list