The bind Command

The bind command creates event bindings, and it returns information about current bindings. The general form of the command is:

bind bindingTag ?eventSequence? ?command?

If all arguments are present, a binding from eventSequence to command is defined for bindingTag. The bindingTag is typically a widget class name (e.g., Button) or a widget instance name (e.g., .buttons.foo). Binding tags are described in more detail later. Called with a single argument, a binding tag, bind returns the events for which there are command bindings:

bind Menubutton
=> <Key-Return> <Key-space> <ButtonRelease-1>
						<B1-Motion> <Motion> <Button-1> <Leave> <Enter>
					

The events in this example are keystroke and mouse events. <Button-1> is the event generated ...

Get Practical Programming in Tcl & Tk, Third Edition 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.