# class `Event`

An Event object represents an input event such as a mouse click or keystroke.

## Attributes

> `kind`
>   A code indicating the type of event. One of:
> - `'mouse_down'`
> - `'mouse_drag'`
> - `'mouse_up'`
> - `'mouse_move'`
> - `'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.
> delta
>   For mouse-move and mouse-drag events, a 2-tuple representing the relative mouse motion since the last mouse event, unconstrained by screen boundaries. Currently implemented only on MacOSX.
> `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.
> button
>   For mouse-down and mouse-up events, the mouse button that caused the event. One of 'left', 'middle' or 'right'.
>   NOTE: Portable applications should not rely on all of these values being available. Some platforms have only 2 buttons (e.g. Windows) or 1 button (e.g. Macintosh). You should provide alternative ways of invoking middle and right mouse button functions if you want your application to be usable on these platforms.
> `char`
>   For key-down and key-up events, the ASCII character corresponding to the key. If the key is not associated with a character, or the character cannot be represented in ASCII, this is an empty string.
> unichars
>   For key-down and key-up events, a Unicode string representing the textual value of the key, if any.
> `key`
>   For keys which do not have an ASCII character, and certain other special keys, this is a string naming the key. It may have the following values:

> `'left_arrow' 'right_arrow' 'up_arrow' 'down_arrow' 'return'
> 'enter'
> 'f1' to 'f15'
> `
> `'insert'
> ``'delete'
> ` `'home'
> 'end'
> 'page_up'
> 'page_down'
> `

>   Note: The Return key on the main keyboard and the Enter key on the numeric keypad both set the char attribute to '\r'. They are distinguished by the key attribute being set to 'return' for the Return key and 'enter' for the Enter key. (On most PC keyboards, both of these keys are marked "Enter", but the same behaviour applies.)
>   Note: On Macintosh keyboards, the insert key is labelled "Help".
>   Note: On the Macintosh, keystrokes with the Option key produce accented characters and other special symbols which cannot be represented in ASCII; for these, the char attribute will be empty. The unichars attribute may be used to find the Unicode value for these characters, and the key attribute will contain an ASCII string identifying the keyboard key that was pressed. For example, Option-a produces unichars = u'\xe5' and key = 'a'.
> `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.

## Modifier Attributes

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:

`extend_contig`
`extend_noncontig`
  These indicate that a selection is to be extended contiguously or non-contiguously. If neither of these is true, a new selection is to be begun or an existing selection deselected.
`option`
  This is a general-purpose modifier whose interpretation is up to the programmer.

The low-level modifiers are:

`shift`
`control`
  These represent the state of the shift and control keys on the keyboard. They ought to be available on most platforms, although there may be exceptions (early Macintosh keyboards, for example, had no Control key).

## Methods

> `position_in(`view`)`
>   Returns the location of the event in the coordinate system of the specified view.