Modifiers & keys#
Modifiers#
A modifier requires a key or button to be held for the pattern to match.
Prefix it to the type: <Control-c>, <Shift-Button-1>,
<Control-Alt-Delete>.
Modifier |
Requires |
|---|---|
|
The Control key. |
|
The Shift key. |
|
The Alt key. On some Linux keymaps Alt is a |
|
Caps Lock to be on. |
|
The ⌘ Command key (macOS). |
|
The ⌥ Option key (macOS). |
MetaM |
The Meta key (whichever |
Mod1 … Mod5M1 … M5 |
A numbered X modifier. Which physical key maps to which number is platform-dependent. |
Button1 … Button5B1 … B5 |
A mouse button held down — used with |
DoubleTripleQuadruple |
The pattern to repeat 2 / 3 / 4 times in quick succession, close in time
and space — |
|
The event to come from an extended key — numeric keypad, cursor cluster, right-hand Alt/Control (Windows). |
Key symbols#
For a key event, the detail is a key symbol (keysym) — a name for the key.
A printable key is its own symbol (a, A, 1, space for the space
bar). Non-printing keys have names:
Key |
Symbol |
Pattern |
|---|---|---|
Enter / Return |
|
|
Escape |
|
|
Tab |
|
|
Backspace |
|
|
Delete |
|
|
Insert |
|
|
Space |
|
|
Arrows |
|
|
Home / End |
|
|
Page Up / Down |
|
|
Function keys |
|
|
Tip
To discover any key’s symbol, bind <KeyPress> and print event.keysym
(the key name) or event.char (the character it produced). See
The event object.