Is it possible to bind all instances of ttk.Button
in my app in a single bind to '<Return>'
event, so when Enter button is pressed, ttk.Button
callback will be triggered.
In addition, some buttons may have a lambda
callback, so is there a generalised way to do that?
I know this can be done by explicitly binding every button, but can it be done with bind_class
, perhaps? Or subclassing a ttk.Button?
Clarification:
I don't want the same callback be triggered when any of the buttons are pressed with button.
I want buttons own callback triggered, when this particular button is in focus and button is pressed on keyboard.
And this is not a default behavior of a ttk.Button
widget.
I am using Python 3.