[PyQt] Changing the wrapped object

Phil Thompson phil at riverbankcomputing.com
Fri May 4 13:42:11 BST 2012


On Fri, 4 May 2012 14:33:10 +0200, Jens Thoms Toerring <jt at toerring.de>
wrote:
> Hi,
> 
>    I have a C++ class SIP-wrapped with the '/Abstract/'
> annotation, Thus Pyton just has a pointer to instances of
> this class (and ownership is with C++). Now, at a certaind
> point I would like to make the Python wrapper object point
> to a different instance (of the same class). Finding the add-
> ress of the Python object is simple using sipGetPyObject().
> But is there some way make that Python object refer to a dif-
> ferent of my C++-objects? I guess that there's some pointer
> to my C++ object in that Python object that just need to be
> modified to point to the new instance of the C++ class. I've
> been going through all of the dicumentation several times but
> haven't found anything that looks as if would do something
> like that. And, of course, I wouldn't like to mess with un-
> documented features of the SIP-wrapper, resulting in every-
> thing breaking with the next SIP release;-)
> 
>                    Thanks and best regards, Jens

There is no supported way of doing this.

Phil


More information about the PyQt mailing list