inheriting from directgui

i am trying to inherit from directgui elements, however if i do so they are not visible:

from direct.gui.DirectGui import DirectButton
from pandac.PandaModules import *

class Test( DirectButton ):
  def __init__( self ):
    # this one is not visible (red)
    DirectButton.__init__( self,
      parent      = aspect2d,
      pos         = (0, 0, 0),
      frameSize   = (-.5, 0, -.5, 0),
      frameColor  = (1, 0, 0, 1),
    )
    
    # this one is (blue)
    a = DirectButton(
      parent      = aspect2d,
      pos         = (0, 0, 0),
      frameSize   = (0, .5, 0, .5),
      frameColor  = (0, 0, 1, 1),
    )

from direct.directbase import DirectStart
a = Test()

run()

the blue button will be visible, the red is invisible.

How can i make this work?

Search for “initialiseoptions”.

thanks, i didnt find that during search.

for reference, this one works:

from direct.gui.DirectGui import DirectButton
from pandac.PandaModules import *

class Test( DirectButton ):
  def __init__( self ):
    # this one is not visible (red)
    DirectButton.__init__( self,
      parent      = aspect2d,
      pos         = (0, 0, 0),
      frameSize   = (-.5, 0, -.5, 0),
      frameColor  = (1, 0, 0, 1),
    )
    self.initialiseoptions( Test )

from direct.directbase import DirectStart
a = Test()

run()