Ich hab hier ein paar Klassen (vereinfacht):
Code: Alles auswählen
class Displayable(object):
__slots__ = ['_rect']
def __init__(self):
super(Displayable,self).__init__()
class Surface(Displayable):
__slots__ = ['_surface']
def __init__(self):
super(Surface,self).__init__()
class Mouse(object):
__slots__ = ['_state','_key']
NORMAL = 0
OVER = 1
PRESSED = 2
def __init__(self):
super(Mouse,self).__init__()
class Button(Surface,Mouse):
__slots__ = ['_command','_active','_disabled','_hover','_pressed']
def __init__(self, command, active,disabled=None,hover=None,pressed=None):
Code: Alles auswählen
Traceback (most recent call last):
File "C:\Projects\Mediaplayer\cd_ripper\display.py", line 358, in __main__
class Button(Surface,Mouse):
TypeError: multiple bases have instance lay-out conflict
Hab noch nie Mehrfachvererbung gebraucht.
Gruss