Next / Previous / Contents / Shipman's homepage

54.2. Event sequences

Tkinter has a powerful and general method for allowing you to define exactly which events, both specific and general, you want to bind to handlers.

In general, an event sequence is a string containing one or more event patterns. Each event pattern describes one thing that can happen. If there is more than one event pattern in a sequence, the handler will be called only when all the patterns happen in that same sequence.

The general form of an event pattern is:

<[modifier-]...type[-detail]>

Here are some examples to give you the flavor of event patterns:

<Button-1> The user pressed the first mouse button.
<KeyPress-H> The user pressed the H key.
<Control-Shift-KeyPress-H> The user pressed control-shift-H.