Show all available bindings for given widget - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: Code sharing (https://python-forum.io/forum-5.html) +--- Thread: Show all available bindings for given widget (/thread-1119.html) |
Show all available bindings for given widget - Larz60+ - Dec-05-2016 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: 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)
what happened to the output?? Edit admin: Fixed output. |