[PyQt] C++ and embedded python, how to share gui thread?

Michael Olberg michael.olberg at chalmers.se
Wed May 16 13:49:48 BST 2007

Dear all,

I have a scientific application programmed in C++ with the Qt widget set. I have 
embedded a Python interpreter to allow me to control the application via 
scripts. I can even import the python-qt bindings in those scripts and create 
graphical dialogs. So at present everything works(!) as expected.

However, this works with an old setup of Debian sarge and the 
python2.3-qt3_3.11-4_i386.deb package. A number of upgrades have happened since 
then, with python, with qt, and even with Debian. With newer versions 
non-graphical scripts still work, but any attempt to open Qt dialogs from the 
embedded python interpreter hangs the application.

It appears to me that this has to do with how later versions of the python-qt 
package access the main Qt GUI thread, which in my case is already started by 
the underlying C++ application.

I wonder if this is documented somewhere, with an example on how to start the 
python interpreter so that the C++ and python can share the same Qt GUI? I'd 
very much like to upgrade my system without breaking this application, which I 
use for daily work.

any info appreciated,

More information about the PyQt mailing list