event_generate options#
widget.event_generate(sequence, **options) synthesizes an event and
dispatches it to widget. The options fill in the fields the event would
normally carry; each mirrors a Tk -option with the leading dash dropped
(Tk -rootx → rootx=). See
Events & callbacks for how
to use it.
widget.event_generate("<Button-1>", x=10, y=20, when="now")
widget.event_generate("<<DataLoaded>>")
Options#
Keyword |
Applies to |
Sets |
|---|---|---|
|
pointer & key events |
Position relative to the target widget. |
|
pointer & key events |
Position relative to the screen. |
|
Button events |
The button number. |
|
key events |
The key symbol (overrides the detail). |
|
key events |
The hardware key code. |
|
MouseWheel |
The wheel rotation amount. |
|
pointer, key events |
The modifier/button bitmask. |
|
Configure |
The reported size. |
|
pointer & key events |
If true, actually move the mouse pointer to the given position. |
|
virtual events |
User data. Accepted, but not readable on tkinter’s event object — see The event object. |
|
all |
When the event is processed (see below). |
when#
Value |
Effect |
|---|---|
|
Process immediately, before |
|
Queue behind the events already waiting. |
|
Queue ahead of all waiting events. |
|
Queue ahead of normal events but behind earlier |
Note
The full Tk option set (-above, -borderwidth, -count,
-detail, -focus, -mode, -override, -place, -root,
-sendevent, -serial, -subwindow, -time) is also accepted with
the dash dropped, for filling in fields of the more specialized event types.