On Friday 13 June 2003 04:21 am, Phil Thompson wrote: > On Friday 13 June 2003 12:31 am, Rob Knapp wrote: > > I've found myself in a position where I need to present a python object > > to a C++ object, and it needs to look like a C++ object. The target > > application knows nothing of python. > > What C++ object does it need to look like?
It needs to be a QObject, more specifically we want it to inherit from QWidget ...which is why SIP looks like such a good match. > > Would it be possible to create an object using SIP that I can inherit > > from and use the SIP api to convert into a CppPointer? > > If you have a C++ ctor for the object then that's exactly what SIP does, so > maybe what you want to do is more complicated than your are implying? So, if I inherit a C++ object from QWidget and write a sip binding, then I'm set. That's what I thought, but what I was hoping for was some way to automatically generate this "in between" object. Here is what I'm trying to do: Let's say I need to add some slots to QWidget and a couple of methods, I then need to embed this on a dialog box made by someone else in C++. That dialog box needs access to these additional methods and slots. >From what I'm seeing in the responses, I would write a C++ class(QMyddrin) that inherits from QWidget and adds these methods. Then my python ocde I would inherit from QMyddrin and it should all work as long as I do the conversion from Py_Object to CppPointer (I forget the call name.) That may be enough becuase I can probably modify some existing python introspection code that I have to spit out the .h, .cpp and .sip files fairly easily. > > Is there another/better way to achieve this? > > Phil > > The address of the PyKDE mailing list has changed. > > _______________________________________________ > PyKDE mailing list [EMAIL PROTECTED] > http://mats.imk.fraunhofer.de/mailman/listinfo/pykde _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
