How to capture events on tkinter child widgets?

后端 未结 4 1835
谎友^
谎友^ 2021-02-15 13:51

In the following block, clicking on a_frame triggers the event handler on_frame_click, but clicking on a_label which is a child of a

4条回答
  •  梦毁少年i
    2021-02-15 14:18

    Based on what it says in the Levels of Binding section of this online Tkinter reference, it sounds like it's possible because you can bind a handler to three different levels.
    To summarize:

    1. Instance Level: Bind an event to a specific widget.
    2. Class Level: Bind an event to all widgets of a specific class.
    3. Application Level: Widget independent -- certain events always invoke a specific handler.

    For the details please refer to the first link.

    Hope this helps.

提交回复
热议问题