Is there a reference site that contains, for each Tkinter widget, a list of all available sequences for binding?
For example, I can bind a callback to a TreeView with this code:
tree.bind("<<TreeviewSelect>>", selection_changed)
However, I can't seem to find a good resource that will list all possible events to which a callback can be assigned.
You can use this code to get events for some widget (except virtual events):
from itertools import chain
def get_events(widget):
return set(chain.from_iterable(widget.bind_class(cls) for cls in widget.bindtags()))
root = Tk()
a = get_events(Button())
print(a)
root.destroy()
>>> {'<KeyRelease-Alt_R>', '<Enter>', '<Key-space>', '<Button-1>', '<Key-Alt_R>', '<KeyRelease-F10>', '<<PrevWindow>>', '<Alt-Key>', '<Alt-KeyRelease>', '<ButtonRelease-1>', '<Leave>', '<KeyRelease-Alt_L>', '<Key-Alt_L>', '<Key-F10>', '<Key-Tab>'}
And links: Master list of all Tkinter Events?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With