Events List
Event |
Code |
Note |
left mouse button Click to press the |
1/button-1/buttonpress-1 |
|
left mouse button click to release |
ButtonRelease-1 |
|
Right-click |
3 |
|
Left mouse button Double-click |
Double-1/double-button-1 |
|
right mouse button Double-click |
Double-3 |
|
Mouse wheel Click |
2 |
|
Mouse Wheel Double-click |
Double-2 |
|
Mouse movement |
B1-motion |
|
Move Mouse to Area |
Enter |
|
Mouse off area |
Leave |
|
Get keyboard focus |
Focusin |
|
Lose keyboard focus |
Focusout |
|
Keyboard events |
Key |
|
Enter |
Return |
|
Control dimensions Change |
Configure |
|
Response Time Advance response
The Treeviewselect event of the TTK TreeView is advanced, that is, you have selected a row, and treeview.selection () [0] is the same.
Postpone the corresponding
For example, if the TTK TreeView is clicked, the clicked Row is selected, but the selected row is not obtained by treeview.selection () [0]! Instead, the previously selected row. can refer to the following here.
Response function
Event_handler (Event,*args)
Event parameter
The event parameter has the following properties:
[' __doc__ ', ' __module__ ', ' char ', ' delta ', ' height ', ' keycode ', ' keysym ', ' keysym_num ', ' num ', ' send_event ', ' Serial ', ' s Tate ', ' Time ', ' type ', ' widget ', ' width ', ' x ', ' x_root ', ' y ', ' y_root ']
Event Attributes
-
-
Widgets
-
-
The widget which generated this event. This was a valid Tkinter widget instance, not a name. This attribute is set to all events.
-
-
X, y
-
-
The current relative position of the mouse, in pixels.
For example, the TTK TreeView has a way to locate rows through the y-coordinate: identify_row (self, y)
-
-
X_root, Y_root
-
-
The current absolute position of the mouse relative to the upper-left corner of the device. In pixels.
-
-
Char
-
-
Character (only in keyboard events), the type is a string.
-
-
Keysym
-
-
The key symbol (keyboard events only).
Key (only in keyboard events)
-
-
KeyCode
-
-
Key code (only in keyboard events).
-
-
Num
-
-
Button number (only in mouse event) 1-left/2-Middle/3-right
-
-
width, height
-
-
The new size of the widget, in pixels (Configure events only).
-
-
Type
-
-
Event Type
-
-
1---
-
-
2---
-
-
3---
-
-
4---Mouse
-
-
-
For more information, see here.
-
Binds the event control. Bind (' < event code > ', Event_handler)
Applies to most controls. There are also bind_all methods.
Control. Protocal (' event code ', Event_handler)
The control of this case must be the top-level window or the root container.
Python GUI's Tkinter event handling