[PyKDE] Is it possible to fake multiple inheritance with PyQt ?

Eric Jardim ericjardim at gmail.com
Fri Sep 9 12:11:12 BST 2005


2005/9/8, İsmail Dönmez <ismail at uludag.org.tr>:
> 
> > You are not "faking" MI, with this. You are actualy doing it.
> Yeah but its not working as say it does in C++


The difference of C++ MI and Python MI, is that one is statically defined, 
and the other is resolved dynamically. For us (humans) only what matters is 
*behaviour*.

> BTW, in Qt4, QThread is also a QObject.
> Yeah I noticed too, which is a good thing.


You should check python-qt4. But don't wait for threads to work with it. 


Then I can't use QThread functions like start() which shows this is still 
> not
> 100% inheritance.


Why not? I don't know how PyQt classes are implemented, but they should be 
as "new style classes". If not I suspect that MI would not work correctly. 
Anyway, there are several ways to achieve the expected behaviour.

You can do something like:
class Thread(QObject):
def __init__(...)
self.thread = QThread()
...

def __getattr__(self, attr):
return geattr(self.thread, attr)

Don't give up so soon.

[Eric Jardim]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050909/ee32c783/attachment.html


More information about the PyQt mailing list