enable.interactor module

Defines the Interactor class

class enable.interactor.Interactor[source]

Bases: traits.has_traits.HasTraits

The base class of any Enable object that receives keyboard and mouse events. Adds the notion of “state” which determines which set of event handler methods get called. The default state is “normal”, so a “left_down” event would be dispatched by calling:

self.normal_left_down(event)

The event suffixes are:

  • left_down

  • left_up

  • left_dclick

  • right_down

  • right_up

  • right_dclick

  • middle_down

  • middle_up

  • middle_dclick

  • mouse_move

  • mouse_wheel

  • mouse_enter

  • mouse_leave

  • key_pressed

  • key_released

  • character

  • dropped_on

  • drag_over

  • drag_enter

  • drag_leave

dispatch(event, suffix)[source]

Public method for sending mouse/keyboard events to this interactor. Subclasses may override this to customize the public dispatch behavior.

Parameters
  • event (enable.BaseEvent instance) – The event to dispach

  • suffix (string) – The type of event that occurred. See class docstring for the list of possible suffixes.

get_event_transform(event=None, suffix='')[source]

Returns the 3x3 transformation matrix that this interactor will apply to the event (if any).