chaco.examples.demo.basic.line_drawing module

Line drawing tool

Demonstrates using a line segment drawing tool on top of the scatter plot from simple_scatter.py.

Pan using right-drag. Zoom interactions are the same as in simple_line.py.

Line segment drawing:
  • left click places a new point

  • moving over an existing point and left-dragging will reposition that point

  • moving over an existing point and ctrl-left-clicking will delete that point

  • pressing “Enter” will “finalize” the selection. This means that the tool’s _finalize_selection() method will be called, and the list of drawn points will be reset. By default, _finalize_selection() does nothing, but subclasses can customize this.

class chaco.examples.demo.basic.line_drawing.Demo

Bases: traits.has_traits.HasTraits

class chaco.examples.demo.basic.line_drawing.MyLineDrawer(component=None, **kwtraits)

Bases: chaco.tools.line_segment_tool.LineSegmentTool

This class demonstrates how to customize the behavior of the LineSegmentTool via subclassing.

chaco.examples.demo.basic.line_drawing.random(size=None)

Return random floats in the half-open interval [0.0, 1.0). Alias for random_sample to ease forward-porting to the new random API.