[C++-sig] PyQt (SIP) and Boost.Python interop?

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Apr 9 01:32:07 CEST 2009

Since I didn't see any other responses, I'll offer what I know, even though it doesn't directly answer
your question.

A few years ago I experimented with SWIG - Boost.Python integration, where you can get easy access
from C++ to SWIG-wrapped objects, inside a function wrapped with Boost.Python. The code is here:


Look for the files swig_arg.hpp, swig_args_ext.cpp, and search for "libswig" in the

I haven't tried this out for a long time.
Anyway, I hope it gives you a start.


----- Original Message ----
From: Marcus Lindblom <macke at yar.nu>
To: cplusplus-sig at python.org
Sent: Tuesday, April 7, 2009 12:39:31 AM
Subject: [C++-sig] PyQt (SIP) and Boost.Python interop?


We're in a spot where we're using third-party libraries that use different python wrappers. (Boost.Python, SIP currently, possibly SWIG later).

Our own C++-classes are wrapped with Boost.Python a.t.m, but some of them contain Qt-objects, so PyQT needs to be used for that. Python is dynamic, so this ought to be doable, if not easy. :)

Has anyone attempted to get this to work?
What is the best strategy?
Any pitfalls?
Any code? :)

I did manage to write a __getattr__ for my boost.python-wrapped qobject-inheriting classes that forwards to pyqt, but it won't work for dir() and I haven't managed to write __dir__ for my class as I need the self-object to be able to get the pyqt/sip wrapped instance.

All help greatly appreciated.


Cplusplus-sig mailing list
Cplusplus-sig at python.org

More information about the Cplusplus-sig mailing list