[PyQt] GraphicsItem, QObject Inheritance problem
Phil Thompson
phil at riverbankcomputing.com
Thu Oct 1 08:34:27 BST 2009
On Wed, 30 Sep 2009 17:43:03 -0700 (PDT), Jason H <scorp1us at yahoo.com>
wrote:
> I am working on a hacked PyQt to play with the new animation features. So
> this isn't entirely kosher, however.
>
> I have the following:
> class AffineItem(QGraphicsItem):
> def __init__(self, ..., parent):
> QGraphicsItem.__init__(self, parent)
>
> class WrappedAffineItem(QObject, AffineItem):
> def __init__(self ...):
> QObject.__init__(self)
> AffineItem.__init__(self, ..., parent)
>
> The WrappedAffineItem needs to declare properties, so I have to inherit
> QObject.
> Here is the traceback of what I am getting:
>
> Traceback (most recent call last):
> i = WrappedAffineTextItem(text, ..., self.items['clipItem'])
> File "C:\Qt\PyQt-win-gpl-4.5.2\Plaza.py" in __init__
> AffineTextItem.__init__(self, '', font, brush, parent)
> File "C:\Qt\PyQt-win-gpl-4.5.2\Plaza.py", line 8, in __init__
> QGraphicsItem.__init__(self, parent)
> TypeError: argument 1 of PyQt4.QtCore.QObject() has an invalid type
>
> Help?
> Thanks!
You can't multiply inherit from 2 C++ classes.
Phil
More information about the PyQt
mailing list