[PyKDE] About getting Qt C++ hidden under a PyObject*

Gerard Vermeulen gvermeul at grenoble.cnrs.fr
Mon Oct 6 16:54:01 BST 2003

On Mon, 06 Oct 2003 16:39:25 +0200
Pierre Barbier de Reuille <pierre.barbier at cirad.fr> wrote:

> Hello,
> I know nothing about how SIP works, but I'm using PyQt to build the
> interface of my application. I need to write C++ extensions in order to
> have efficient enough routines. But I already learned a C++ - Python
> binding library (namely Boost.Python) and I do not really intend in
> learning another one. So, I wondered if there was a way to extract the
> Qt C++ object if I have the PyObject* without exporting my own C++
> object using sip (they're already exported ...).
> Thanks for your help,

I think so, see my post of last Thursday replying Joe Van Andel.
The attached example concerned Vtk Python objects, but I would try
the same approach for Boost.

There may be a few gotchas, though:
(1) sip generated modules do not use Python's standard way of importing
    other modules' C-API's. I solve this by patching sip's output.
(2) it is probably impossible to mix the inheritance hierarchies of
    sip-generated and boost-generated classes.

I have a vague recollection of a thread about mixing SIP and Boost.


More information about the PyQt mailing list