How would you put a button in the ‘down’ state on the first click and in the ‘normal’ state on the second click? And would you make this out of a DirectButton or a DirectCheckButton? This is what I’ve tried so far.
from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectGui import *
class Core(ShowBase):
def __init__(self):
ShowBase.__init__(self)
ButtonBar()
class ButtonBar():
def __init__(self):
self.makebtns()
def makebtns(self):
self.btnsr = DirectButton(command=self.toggle)
self.btnsr['extraArgs'] = [self.btnsr]
def toggle(self,me):
if me['state'] == 'normal':
me['state'] = 'down'
core = Core()
core.run()
Changing the state to ‘down’ freezes the Button because its not a valid state.