is there an obvious reason why DirectGui classes don’t offer any kind of ‘id’ or ‘name’ property – or do they? It’s not that one can’t work around this but I was just wondering …
Which leads to my actual (quite embarassing) question: When I try to derive a class from DirectButton, I don’t get the keyword parameters up to the super class, no matter how hard I try. It always ends up with python complaining about either wrong argument number or wrong argument type. I tried lots of varations of “DirectButton.init” as well as “super” calls. Could anyone help me out here (minimal example below)?
import direct.directbase.DirectStart from direct.gui.DirectGui import DirectButton from direct.gui.DirectGui import DirectFrame from direct.showbase.DirectObject import DirectObject class World(DirectObject): def __init__(self): f = DirectFrame() b = IDButton(parent=f, text='Hello', scale=.2) class IDButton(DirectButton): def __init__(self, parent = None, **kw): #super(IDButton, self).__init__(parent, kw) DirectButton.__init__(self, parent, kw) self.id = '' w = World() run()
Thank you, Christof.