enable.drawing.drawing_canvas module¶
-
class
enable.drawing.drawing_canvas.
Button
(**traits)[source]¶ Bases:
enable.component.Component
-
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:
The component’s active tool, if any.
Any overlays, in reverse order that they were added and are drawn.
The component itself.
Any underlays, in reverse order that they were added and are drawn.
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?)