Attach a callback to a Tk window that will be called by the Tcl event loop when one of the window event types (e.g. ButtonPressMask for button presses, KeyPressMask for key presses, StructureNotifyMask for delete and create events, VirtualEventMask for virtual events) selected by the mask happens. Most of the masks are defined by X11.