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

Marcus Lindblom macke at yar.nu
Tue Apr 14 14:03:36 CEST 2009

Ralf W. Grosse-Kunstleve wrote:
> 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:
> http://cctbx.svn.sourceforge.net/viewvc/cctbx/trunk/boost_adaptbx/
> Look for the files swig_arg.hpp, swig_args_ext.cpp, and search for "libswig" in the
> SConscript.
> I haven't tried this out for a long time.
> Anyway, I hope it gives you a start.

Thanks. Hm.

I've currently done this in python:

f = MyWidget() # MyWidget is a boost::python wrapped object that 		
                # inherits QTimer, that has start()

def _q_getattr(self, attr):
     if type(self) == type(type(MyWidget)):
         raise AttributeError
	return getattr(sip.wrapinstance(self.myself(), QObject), attr)

MyWidget.__getattr__ = _q_getattr

f.start() # works! :)

But I want to implement __dir__ in the same way to get full coverage, 
and that's trickier.


More information about the Cplusplus-sig mailing list