chaco.examples.demo.basic.polygon_move module

Polygon plot with drag-move.

Shares same basic interactions as polygon_plot.py, but adds a new one:
  • Right click and drag to move a polygon around.

class chaco.examples.demo.basic.polygon_move.DataspaceMoveTool(component=None, **traits)

Bases: enable.tools.drag_tool.DragTool

Modifies the data values of a plot. Only works on instances of BaseXYPlot or its subclasses

drag_start(event)

Called when the drag operation starts.

The event parameter is the mouse event that established the drag operation; its x and y attributes correspond to the current location of the mouse, and not to the position of the mouse when the initial left_down or right_down event happened.

dragging(event)

This method is called for every mouse_move event that the tool receives while the user is dragging the mouse.

It is recommended that subclasses do most of their work in this method.

is_draggable(x, y)

Returns whether the (x,y) position is in a region that is OK to drag.

Used by the tool to determine when to start a drag.

class chaco.examples.demo.basic.polygon_move.Demo

Bases: traits.has_traits.HasTraits