I have a set of Python Kivy ToggleButtons which are all apart of the same group, e.g.
self.add_widget(CustomToggleButton("0", "group1"))
self.add_widget(CustomToggleButton("1", "group1"))
self.add_widget(CustomToggleButton("2", "group1"))
self.add_widget(CustomToggleButton("3", "group1"))
self.add_widget(CustomToggleButton("4", "group1"))
self.add_widget(CustomToggleButton("5", "group1"))
Because they are part of the same group only one can be pressed at a time. This is the desired behavior, however I want to also disable the ability to "re-click" on a pressed down toggle button to turn it off. i.e. the user will only be able to turn the toggle button off by turning another one on.
Good day. Bind to each button on the on_release
event, the following function.
#python code
def staydown_callback(self, btn, *args):
setattr(btn, 'state', 'down')
#kvlang
on_release: setattr(self, 'state', 'down') #self is the button