[PySide] PySide C++ hybrid app.

David García Garzón david.garcia at upf.edu
Mon Mar 31 09:08:37 CEST 2014


I am the author of that clam code, coded by taking lots of snippets
around. I am glad to see that putting altogether was useful to somebody
else :-) But high level functions like those, with a more reliable base
than what i coded, are a must for sip and shiboken.

What i missed is some way of identifying objects wrapped with Sip and
objects wrapped with shiboken, in order to mix them and being able to
use conditional code. I asked here some time ago but i got no answer.

If you find it useful i could setup a github for the wrapping code, so
that anyone could enhance it.

David.


El 17/03/14 18:42, ntod8729 at uni.sydney.edu.au ha escrit:
> Hi Michal,
> 
> You need to first embed the Python interpreter into your C++ application. You can find the relevant information on doing that here<http://docs.python.org/2/extending/embedding.html> . Section 5.3 shows you how you can call a Python function from C++. You then need to wrap your function arguments as PyObects using either the python C API (for types such as int, char * etc.) or shiboken (for Qt classes) in order to pass them to your Python function. You will also need to unwrap any return types to retrieve a pointer to use in C++. There is some code that demonstrates the wrapping/unwrapping here in some of the source from the CLAM project<http://clam-project.org/clam/trunk/ipyclam/>. Admittedly I haven't tried the shiboken code myself as I had already rolled my own before stumbling across this, but I based some code on their sipunwrap source for doing the same thing with PyQt without any problems.
> 
> Hope this helps,
> Nick ?
> 
> 
> ________________________________
> From: pyside-bounces+ntod8729=uni.sydney.edu.au at qt-project.org <pyside-bounces+ntod8729=uni.sydney.edu.au at qt-project.org> on behalf of Michał Pachocki <mpachock at gmail.com>
> Sent: Monday, 17 March 2014 3:39 PM
> To: pyside at qt-project.org
> Subject: [PySide] PySide C++ hybrid app.
> 
> Hello,
> 
> In tutorial "SuperHybrids part 2, now Qt + PySide [1]" there is a description how run python code from c++ lib, but the app is running from python. How to make calls to PySide from native C++ app, so C++ objects will be visible from Python and vice-versa?
> 
> [1] http://lynxline.com/superhybrids-part-2-now-qt-pyside/
> 
> regards,
> mp
> 
> 
> 
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
> 




More information about the PySide mailing list