Multi-event sequences and ignored events

When a sequence specified in a tk/bind command contains more than one event pattern, then its script is executed whenever the recent events (leading up to and including the current event) match the given sequence.

This means, for example, that if button 1 is clicked repeatedly the sequence <Double-ButtonPress-1> will match each button press but the first.

If extraneous events that would prevent a match occur in the middle of an event sequence then the extraneous events are ignored unless they are KeyPress or ButtonPress events. For example, <Double-ButtonPress-1> will match a sequence of presses of button 1, even though there will be ButtonRelease events (and possibly Motion events) between the ButtonPress events.

Furthermore, a KeyPress event may be preceded by any number of other KeyPress events for modifier keys without the modifier keys preventing a match. For example, the event sequence aB will match a press of the a key, a release of the a key, a press of the Shift key, and a press of the b key: the press of Shift is ignored because it is a modifier key.

Finally, if several Motion events occur in a row, only the last one is used for purposes of matching binding sequences.


© Author | Home | Sitemap