I needed to know available bindings for a ttk Notebook widget, and had a hard time finding them
This class will show available bindings for any widget:
what happened to the output??
Edit admin:
Fixed output.
This class will show available bindings for any widget:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
class WidgetBindings: def __init__( self , wobject): instance = wobject() self .process(instance) instance.destroy() @ staticmethod def process(instance): bindings = set () for bindtag in instance.bindtags(): bindings | = set (instance.bind_class(bindtag)) for item in bindings: print (item) if __name__ = = '__main__' : import tkinter.ttk print ( 'ttk.Notebook bindings' ) WidgetBindings(tkinter.ttk.Notebook) |
Output:ttk.Notebook bindings
<Destroy>
<Control-Shift-Key-Tab>
<Key-Right>
<Control-Key-Tab>
<Button-1>
<Key-Left>
<Destroy>
<Control-Shift-Key-Tab>
<Key-Right>
<Control-Key-Tab>
<Button-1>
<Key-Left>
<Destroy>
<Key-F10>
<<PrevWindow>>
<KeyRelease-F10>
<KeyRelease-Alt_L>
<Key-Alt_R>
<Button-1>
<Key-Left>
<Alt-Key>
<Alt-KeyRelease>
<<NextWindow>>
<KeyRelease-Alt_R>
<Control-Shift-Key-Tab>
<Key-Right>
<Control-Key-Tab>
<Key-Alt_L>
what happened to the output??
Edit admin:
Fixed output.