[PyQt] Multiple Inheritance

Phil Thompson phil at riverbankcomputing.com
Wed Apr 20 18:08:52 BST 2011

On Wed, 20 Apr 2011 13:01:57 +0200, Zoltan Szalai <defaultdict at gmail.com>
> Hi All,
> The PyQt Reference Guide says:
> "It is not possible to define a new Python class that sub-classes from 
> more than one Qt class."
> [ 
> ]
> The code attached works here until you remove the comment before the 
> last line. Then it raises a TypeError.
> I should really use something like this in a PyQt app (if it's not a 
> very bad idea anyway) and I wonder what are the limitations here or what

> are the best practices to solve this kind of problem (if there are any).

When it says "not possible" it really means that you don't get the same
results as you would if you did the same thing in C++. It might be more
accurate to say that it isn't supported.

In C++ you would get a single C++ instance with the behaviour of both
classes. In Python you get two completely separate C++ instances each
implementing the behaviour of one of the classes.


More information about the PyQt mailing list