Importing PythonQt from command line python?
Dynamic Python binding for Qt Applications
Brought to you by:
florianlink,
marcusbarann
Is it possible to import PythonQt without launching a PythonQt-compiled app? AKA would it be possible to compile some PythonQt code and then load this directly from Python? I tried to do this with the examples, but it doesn't work for me; I'm only able to execute "import PythonQt" from the embedded Python console in the examples, but not from independent python scripts
https://sourceforge.net/p/pythonqt/discussion/631393/thread/ec93fba5/
contains a similar discussion. It is not the focus of PythonQt, since there are PySide and PyQt, which both offer just that. Apart from that, it is possible and not that hard to be done.
By now, PythonQt is only a shared library, not a Python C extension.
To make it importable, you need to build a Python c extension that links PythonQt and calls PythonQt::init(). This C extension can then be imported from Python when it is in the sys.path. If more effort is put into it, QtCore, QtGui etc. could each be made a Python C extension which each loads its PythonQt if not already done.
I can answer questions in that direction, but someone else will need to implement this. I don't want to build another PySide which I have to support, including all the end user questions regarding the Qt Api.