[PyQt] Advices on embedding python in Qt/C++ application

Dmitry Shachnev mitya57 at ubuntu.com
Mon Aug 26 12:26:51 BST 2019


Hi Alexis,

On Mon, Aug 26, 2019 at 09:12:37AM +0200, Alexis Barbot wrote:
>  Dear PyQt community,
> (sorry if this email is published twice, I initially sent it before
> suscribing)
>
> I'm asking for help to make a project of integrating python code in a
> Qt/C++ application. The application is developed using Qt5.9 and mingw/gcc
> on windows10 (using c++14 standards).
> I already read the Python page for calling python from c++ (
> https://docs.python.org/3/extending/embedding.html), and I can successfully
> invoke python code from a c++ method. Now my main concern is to pass
> existing object from c++ to the python part, ideally a QVariantMap that may
> contain also custom types of mine. So I considered using PyQt for this,
> assuming I could convert my own types using SIP. However after some trials,
> I figured out I would have to download PyQt sources and compile it if I
> wanted to have some c++ api to pass objects to Python. As I failed to do
> this with mingw and my current Python installation, and before going beyond
> with error messages, I'd like to ask: Is this something already done? Am I
> trying to do it the right way? Are there some issues in my setup?

Have you looked at https://mevislab.github.io/pythonqt/?

I have never used that but it looks like it is exactly for your purpose.

--
Dmitry Shachnev


More information about the PyQt mailing list