[PyQt] PyQt in embedded python (C++/Qt Application)

Marc Gronle Marc.Gronle at gmx.de
Fri Jan 13 14:09:06 GMT 2012


Hello everybody,

I am developing a C++/Qt Application, where we integrated python as scripting engine. I would like to offer the possibility to write PyQt-Scripts in order to generate user-defined interfaces.

In the present case, the python interpreter runs in its own thread within the C++-framework. If I execute the following demo script in Debug-mode (Visual Studio, Windows 7)

-------
from PyQt4 import QtCore, QtGui
app =QtGui.QApplication([])
... (create window, show it...)
app.exec_()
-------

it works (even if python is executed in a second thread). However in Release-mode the line app=QtGui.QApplication([]) crashes with the warning 

WARNING: QApplication was not created in the main() thread.

Does anybody have an idea what is the difference between the debug- and release mode that creates this problem? If I call Py_Initialize() in the second thread, can I assume that this second thread is the main thread for python or not?

I really thank you for some advice.

Cheers

marc

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de


More information about the PyQt mailing list