[PyQt] Calling slots in a QThread?

Arnold Krille arnold at arnoldarts.de
Wed Aug 12 19:26:38 BST 2009


Hi,

On Wednesday 12 August 2009 19:04:46 Lukas Hetzenecker wrote:
> is it possible to connect signals from a Widget to a slot in a QThread and
> ensure that the Widget responds to keypress and mouse events?
> I attached my first try, but it doesn't work, the UI blocks until the
> execution of the function is finished.

Without looking at the code: This is not a problem with Qt but with python. 
The keyword is GIL, the global interpreter lock which ensures that only one 
thread is executing python in this runtime instance.

There are two ways to have "true" threads:
1) Implement the thread in C++ and bridge it to python with SIP the same way 
Qt is bridged to python.
2) Use processes instead of threads. Then you can run several instances of the 
python interpreter at the same time.

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090812/62904d5a/attachment.bin


More information about the PyQt mailing list