enable.drawing.drawing_canvas module

class enable.drawing.drawing_canvas.Button(**traits)[source]

Bases: enable.component.Component

draw_down(gc, view_bounds)[source]
draw_up(gc, view_bounds)[source]
normal_left_down(event)[source]
normal_left_up(event)[source]
perform(event)[source]

Called when the button is depressed. ‘event’ is the Enable mouse event that triggered this call.

class enable.drawing.drawing_canvas.DrawingCanvas(*components, **traits)[source]

Bases: enable.container.Container

A DrawingCanvas has some buttons which toggle what kind of drawing tools are active on the canvas, then allow arbitrary painting on the canvas.

activate(tool)[source]

Makes the indicated tool the active tool on the canvas and moves the current active tool back into the list of tools.

dispatch(event, suffix)[source]

Dispatches a mouse event based on the current event state.

If the component has a controller, the method dispatches the event to it, and returns. Otherwise, the following objects get a chance to handle the event:

  1. The component’s active tool, if any.

  2. Any overlays, in reverse order that they were added and are drawn.

  3. The component itself.

  4. Any underlays, in reverse order that they were added and are drawn.

  5. Any listener tools.

If any object in this sequence handles the event, the method returns without proceeding any further through the sequence. If nothing handles the event, the method simply returns.

Parameters
  • event (an Enable MouseEvent) – A mouse event.

  • suffix (string) – The name of the mouse event as a suffix to the event state name, e.g. “_left_down” or “_window_enter”.

class enable.drawing.drawing_canvas.DrawingCanvasToolbar(*components, **traits)[source]

Bases: enable.container.Container

The tool bar hosts Buttons and also consumes other mouse events, so that tools on the underlying canvas don’t get them.

FIXME: Right now this toolbar only supports the addition of buttons, and

not button removal. (Why would you ever want to remove a useful button?)

add_button(*buttons)[source]
class enable.drawing.drawing_canvas.ToolbarButton(*args, **kw)[source]

Bases: enable.drawing.drawing_canvas.Button