Don't allow a radio button to be turned off

This commit is contained in:
Dave Pearson
2023-02-21 20:17:54 +00:00
parent 3d759d6bad
commit 6c3232ecc7

View File

@@ -99,6 +99,10 @@ class RadioSet(Container):
if button.value and button != event.input:
button.value = False
break
else:
# If this leaves us with no buttons checked, disallow that.
if not any(button.value for button in self._buttons):
event.input.value = True
@property
def pressed_index(self) -> int: