[PyQt] Python callback in SIP

MD marco.dinacci at gmail.com
Mon Jun 15 11:05:16 BST 2009


> No you don't. SIP does all of that for you - otherwise it would be pretty
> useless as a C++ wrapper generator. Just provide a .sip file for your A
> class and you shouldn't need any %MethodCode.

I tried to provide a sip file for A but if I subclass it in Python I
get a TypeError, A cannot be instantiated or sub-classed, which is why
I'm now subclassing A in C++.

And in B, I cant' understand how that can work without some manual
code, sorry. How does SIP understand that the method I want to call is
the Python one and not the C++ one ?
In my B class I have to override the foo method declared virtual in A;
In my Python class I extend from B and I "override" again foo. Are you
saying that SIP will call the foo method on the python class ? How ?
I just made a test, and the Python method is never called.


More information about the PyQt mailing list