An Event object represents an input event such as a mouse click or keystroke.
- kind
- A code indicating the type of event. One of:
'mouse_down' 'mouse_drag' 'mouse_up' 'key_down' 'key_up' position For mouse events, the location of the mouse pointer when the event occurred, in the coordinate system of the component receiving the event. For mouse-down events, this is the component in which the click occurred. For other mouse events, it is the view whose track_mouse method was used to receive the event.
global_position The location in screen coordinates of the mouse pointer when the event occurred. This attribute is valid for all event types.
time Time at which the event occurred. The origin and units are platform-dependent.
num_clicks For mouse-down events, the number of clicks which have so far occurred sufficiently close together in time and space to be considered a multiple click.
char For key-down and key-up events, the ASCII character corresponding to the key. If the key is not associated with an ASCII character, this is an empty string.
- key
- For keys which do not have an ASCII character, this is a string naming the key. It may have the following values:
'left_arrow'
'right_arrow'
'up_arrow'
'down_arrow'
'enter'
'help'
'home'
'end'
'page_up'
'page_down'
- auto
- For key-down events, and on platforms which support it, a boolean indicating that the event is due to an auto-repeating key rather than a physical keystroke.
The following attributes are boolean values indicating the state of mouse
buttons and/or keyboard modifier keys at the time of the event.
There are two groups of modifiers, high-level and low-level. The high-level
modifiers are abstract and are mapped onto the available keys and buttons
in a platform-dependent way. The low-level modifiers, on the other hand,
represent physical keys.
Some of the high-level modifiers may be defined in terms of the low-level modifiers, so the programmer should not rely on all possible combinations of modifiers being distinguishable. Modifiers within each group, however, should always be independent of each other.
The high-level modifiers are:
The low-level modifiers are:
- position_in(view)
- Returns the location of the event in the coordinate system of the specified view.