[PyQt] Fwd: Re: c++ app integrate PyQt

Matt Newell newellm at blur.com
Tue Oct 1 20:06:10 BST 2013


> 
> If you would forward an example to me it would very helpful.  I think
> both of you are suggesting that I wrap the C++ (BTW a very large app)
> and then write the entire program using PyQt. Is that correct. 


In reality you only need to wrap a very very small part of the API to make the 
app a python app.  Once the app is compiled as a library, which should require 
no changes at all(unless you are on windows then you'll need to add dllexport 
for any classes/functions used externally), the only difference being that your 
main isn't called implicitly.

Initially it can be as simple as wrapping a single function so your python 
"program" looks something like:

import myappaslib

if __name__ == "__main__":
    myappaslib.main()


Where the .run function is the contents of your current main function.  Then 
as the need arises you can move stuff into python, such as the creations of the 
QApplication, loading of python functionality, etc.

However you shouldn't have any problems going the other route and embedding 
python in the app. I've done it for years now without issue.

Matt


More information about the PyQt mailing list