enable.events module

Define the event objects and traits used by Enable components.

For a list of all the possible event suffixes, see interactor.py.

class enable.events.BasicEvent[source]

Bases: traits.has_traits.HasTraits

current_pointer_position()[source]

Returns the current pointer position in the transformed coordinates

net_transform()[source]

Returns a single transformation (currently only (dx,dy)) that reflects the total amount of change from the original coordinates to the current offset coordinates stored in self.x and self.y.

offset_xy(origin_x, origin_y, caller=None)[source]

Shifts this event to be in the coordinate frame whose origin, specified in the event’s coordinate frame, is (origin_x, origin_y).

Basically, a component calls event.offset_xy(*self.position) to shift the event into its own coordinate frame.

pop(count=1, caller=None)[source]

Restores a previous position of the event. If count is provided, then pops count elements off of the event stack.

push_transform(transform, caller=None)[source]

Saves the current transform in a stack and sets the given transform to be the active one.

scale_xy(scale_x, scale_y, caller=None)[source]

Scales the event to be in the scale specified.

A component calls event.scale_xy(scale) to scale the event into its own coordinate frame when the ctm has been scaled. This operation is used for zooming.

class enable.events.BlobEvent[source]

Bases: enable.events.BasicEvent

Represent a single pointer event from a multi-pointer event system.

Will be used with events:

blob_down blob_move blob_up

push_transform(transform, caller=None)[source]

Saves the current transform in a stack and sets the given transform to be the active one.

This will also adjust x0 and y0.

class enable.events.BlobFrameEvent[source]

Bases: enable.events.BasicEvent

Represent the framing events for a multi-pointer event system.

Will be used with events:

blob_frame_begin blob_frame_end

These can be used to synchronize the effects of multiple pointers.

The position traits are meaningless. These events will get passed down through all components. Also, no component should mark it as handled. The event must be dispatched through whether the component takes action based on it or not.

NOTE: Frames without any blob events may or may not generate BlobFrameEvents.

class enable.events.DragEvent[source]

Bases: enable.events.BasicEvent

A system UI drag-and-drop operation. This is not the same as a DragTool event.

class enable.events.KeyEvent[source]

Bases: enable.events.BasicEvent

class enable.events.MouseEvent[source]

Bases: enable.events.BasicEvent

A mouse event.

alt_down = ReadOnly

If True, the ALT key is pressed on the keyboard

control_down = ReadOnly

If True, the CTRL key is pressed on the keyboard

left_down = ReadOnly

If True, the left button is pressed on the mouse

middle_down = ReadOnly

If True, the middle button is pressed on the mouse

mouse_wheel = ReadOnly

If a wheel event, holds number of units moved by the wheel

mouse_wheel_axis = ReadOnly

If a wheel event, contains either “horizontal” or “vertical”

mouse_wheel_delta = ReadOnly

If a wheel event, contains a 2D movement vector as a tuple

right_down = ReadOnly

If True, the right button is pressed on the mouse

shift_down = ReadOnly

If True, a SHIFT key is pressed on the keyboard