Hybrid Application with Python GUI with C++ background modules
I want to write a hybrid application which uses pyth开发者_高级运维on as GUI component, and C++ module as background services.
I know how to program with Python, and C++, but I don't find a mature/nice way to make them work together smoothly. Could you guys shed some light on this for me? A good document/tutorial is also very appreciated.
I like to use cython for writing glue code between those two worlds, or if I want stronger separation for any reason I like the ctypes approach.
If you are comfortable with using boost, go for boost python. (Tutorial)
Otherwise, use the CPython API directly.
With either of these, you can create Python modules (.pyd
-files) in C++.
I have experience with boost python, and I find it very comfortable and easy. The downside is that it causes huge compile times because it relies heavily on template metaprogramming.
Besides boost, there's also SWIG (http://www.swig.org/). SWIG was used for wxPython's C++ bindings. The new version of wxPython will be using SIP, which I think PyQt is also using: http://www.riverbankcomputing.co.uk/software/sip/intro
Shed-Skin might also be a possibility: http://shed-skin.blogspot.com/
精彩评论