On Thursday 30 June 2005 09:33, Henning Schröder wrote: > Hi! > > Jim Bublitz <[EMAIL PROTECTED]>: > > [..] > > wrapinstance and unwrapinstance are covered in the sip docs. > > Thanks I will try your C++/Python-mixed solution. > > But I wonder why the following does not work: > ptr = sip.unwrapinstance(qt.qApp.mainWidget()) > mainWindow = sip.wrapinstance(ptr, qt.QMainWindow) > Unfortunately mainWindow is still a QWidget.
I'm not sure - my guess is that it's because ptr is already typed in Python as a QWidget. I've done something similar to get a C++ object into Python, but the object was already the correct type - just instantiating the wrapper, but no cast involved. You might try: mainWindow = sip.cast (ptr, qt.QMainWindow) Jim _______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
