[PyQt] Simple way of signaling (like QueuedConnection) main (qt/qui) thread from python thread ?

Mateusz Korniak mateusz at ant.gliwice.pl
Thu Apr 8 07:43:59 BST 2010

Hi !
I am trying to write simple wrapper [1] for long run tasks so they are run in 
separate thread and results are signaled to main (qt/gui thread). And I have 
big problem implementing final phase - sending QueuedConnection signal from 
python thread to main qt(qui) thread.

Default signaling seems to work but I get my handler executed in context of 
python thread instead of qt thread which is not acceptable. I am unable to use 
other signal types [2].

Seems I have to create QThread(), from it running context create QObject(), 
connect( , QueuedConnection)  and emit() from it is.
Very complicated.

Is there any simple method which could be called safely from other linux 
threads like:

TIA for any help

Invocation looks like
w = MyWrapper(ClassIWantToWrap()).

When I try connect QueuedConnection signals stop to work (hint:
using Qt.BlockingQueuedConnection I get: Qt: Dead lock detected while 
activating a BlockingQueuedConnection: Sender is PyQtProxy(0x94a6800), 
receiver is PyQtProxy(0x94b3428) ) which indicates that PyQt "thinks" I am 
still in main gui thread regardless fact I am executign code in context of 
another python thread.

Mateusz Korniak
"(...) mam brata - poważny, domator, liczykrupa, hipokryta, pobożniś,
 	krótko mówiąc - podpora społeczeństwa."
				Nikos Kazantzakis - "Grek Zorba"

More information about the PyQt mailing list