Events#
The catalog of tkinter’s event system: every event type, modifier, and
key symbol you can name in a pattern, every attribute of the event object a
callback receives, the options for synthesizing events, and the built-in
<<virtual>> event names.
Note
This is standard tkinter — it comes from Tk’s bind and event
commands, which Tk documents only in C-oriented manual pages. This reference
restates the names in Python terms. For how to use them — binding
callbacks, stopping propagation, and generating your own events — see
Events & callbacks in
the User Guide.
Pattern grammar#
An event pattern names which event fires a callback. Its full form is one or more modifiers, a type, and an optional detail, inside angle brackets:
<Control-Shift-KeyPress-Q>
│ │ │ └─ detail which key or button
│ │ └───────── type the kind of event
└───────┴─────────────── modifiers keys/buttons held down
The type is required unless it can be inferred: a bare detail like
<1>means<Button-1>and<q>means<KeyPress-q>.Detail is a button number for button events or a key symbol for key events; omit it to match any button or key.
A
<<Name>>pattern (double brackets) is a virtual event; modifiers may not be combined with one.
Every event type token — KeyPress, Button, Motion,
Configure, <<virtual>> — and when each fires.
The modifier tokens (Control, Shift, Double, …) and the
common key symbols used as the detail of a key event.
Every attribute of the event passed to a callback, the Tk field it
maps to, and which event types populate it.
The keyword options accepted by event_generate and the when
scheduling values.
The predefined <<virtual>> events Tk, ttk, and ttkbootstrap emit.