You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wondered if we could introduce a threshold, so you could specify how many active buttons were required for the event to fire, e.g:
>>>bb=ButtonBoard(2, 3, 4, 5, threshold=4)
i.e. all four buttons must be pressed for the event to fire.
@waveform80 suggested that this should be a separate class - similar to the differentiation between LEDBoard and LEDBarGraph where the new class would have a single 0-1 value rather than an n-tuple. So perhaps ButtonGroup?
This would only allow either one-button activations (with ButtonBoard) or all-button activations (with ButtonGroup) but nothing in-between (unless this can be solved with nesting mentioned in #607) - not a huge problem as I don't expect this to be too common (and can be achieved using other methods).
The text was updated successfully, but these errors were encountered:
What's the imagined use-case for having a ButtonBoard that only fires it's when_pressed event when e.g. any 3 out of a possible 5 buttons are pressed? (if I'm understanding your threshold suggestion correctly)
Or are you specifically only asking for an event that fires when all buttons are pressed. Would adding an when_all_pressed event to the existing ButtonBoard class solve your requirement?
Currently the
ButtonBoard
class has an n-tuple value:and if one button is pressed, the activated callback is fired:
I wondered if we could introduce a threshold, so you could specify how many active buttons were required for the event to fire, e.g:
i.e. all four buttons must be pressed for the event to fire.
@waveform80 suggested that this should be a separate class - similar to the differentiation between
LEDBoard
andLEDBarGraph
where the new class would have a single 0-1 value rather than an n-tuple. So perhapsButtonGroup
?This would only allow either one-button activations (with
ButtonBoard
) or all-button activations (withButtonGroup
) but nothing in-between (unless this can be solved with nesting mentioned in #607) - not a huge problem as I don't expect this to be too common (and can be achieved using other methods).The text was updated successfully, but these errors were encountered: