Name

event

event operation [arg arg...]

The event command provides several facilities for dealing with window system events, such as defining virtual events and synthesizing events. The following operations are defined:

event add <<virtual>> sequence [sequence...]

Add the given event sequences to those associated with the virtual event virtual. The virtual event will trigger whenever any one of the given sequences occurs. See the bind command for allowed sequence values.

event delete <<virtual>> [sequence [sequence...] ]

Delete the given event sequences from those associated with the virtual event virtual. If no sequence is given, all sequences associated with the virtual event are removed.

event generate window sequence [option value...]

Generate an event for window window and arrange for it to be processed just as if it had come from the window system. Window may be a window pathname or an identifier (as returned by winfo id), as long as it is in the current application. The sequence argument describes the event to generate. It may have any of the forms allowed for the sequence argument to the bind command, except that it must consist of a single event pattern (e.g., <Shift-Button-2> or <<Paste>>).

The event generated can be further described with the optional optionvalue pairs. In the descriptions of these options that follow, the [%char] at the beginning identifies the corresponding bind command substitution. The available options are as follows:

-above window

[%a] The above field for ...

Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.