enable.tools.traits_tool module

Defines the TraitsTool and Fifo classes, and get_nested_components function.

class enable.tools.traits_tool.Fifo[source]

Bases: object

Slightly-modified version of the Fifo class from the Python cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68436

class enable.tools.traits_tool.TraitsTool(component=None, **traits)[source]

Bases: enable.base_tool.BaseTool

Tool to edit the traits of whatever Enable component happens to be clicked. Handles containers and canvases so that they get edited only if their background regions are clicked.


Handles the left mouse button being double-clicked when the tool is in the ‘normal’ state.

If the event occurred on this tool’s component (or any contained component of that component), the method opens a Traits UI view on the component that was double-clicked, setting the tool as the active tool for the duration of the view.


Returns a list of fundamental plotting components from a container with nested containers.

Performs a breadth-first search of the containment hierarchy. Each element in the returned list is a tuple (component, (x,y)) where (x,y) is the coordinate frame offset of the component from the top-level container.