[PyQt] c++ app integrate PyQt

Matt Newell newellm at blur.com
Tue Oct 1 01:24:14 BST 2013


On Monday, September 30, 2013 04:51:24 PM John Fabiani wrote:
> Hi,
> I have an existing Qt C++ app (Qt5.1.1).  Is it possible to integrate
> PyQt into the project.  I'd like the PyQt to have access to some of the
> C++ functions, C++ classes, but I want to write frames,windows, all the
> controls in PyQt including accessing the database.  Most important I
> want only one app loop.  I was able in get PythonQt working but realized
> that it was a lot of work to get it to do what I want - that is to
> create a complete sub-program written in python.
> 
> 
> Any hints or links will be helpful.
> 
> Thankis in advance,
> 
> 
> Johnf


Yes it's possible.  You have to wrap any c++ classes you want to use from 
python using sip.  Then you need to embed python in your app, or rewrite the 
main part of the application in python.

You'll want to first split your app into a library so you can test your python 
bindings from a regular python script or cmd interpreter.  Start with one 
class to get your feet wet and go from there.

Matt


More information about the PyQt mailing list