Containers

BasePlotContainer

class enthought.chaco.api.BasePlotContainer(*components, **traits)

Bases: enthought.enable.container.Container

A container for PlotComponents that conforms to being laid out by PlotFrames. Serves as the base class for other PlotContainers.

PlotContainers define a layout, i.e., a spatial relationship between their contained components. (BasePlotContainer doesn’t define one, but its various subclasses do.)

BasePlotContainer is a subclass of Enable Container, so it is possible to insert Enable-level components into it. However, because Enable components don’t have the correct interfaces to participate in layout, the visual results will probably be incorrect.

Traits:

container_under_layers : Tuple(‘background’, ‘image’, ‘underlay’, ‘plot’)

Redefine the container layers to name the main layer as “plot” instead of the Enable default of “mainlayer”

draw_order : Instance(list, args=(DEFAULT_DRAWING_ORDER))

draw_layer : Str(‘plot’)

use_draw_order : Bool(True)

Deprecated flag to indicate that a component needed to do old-style drawing. Unused by any recent Chaco component.

plot_components : Property

Deprecated property for accessing the components in the container.

OverlayPlotContainer

class enthought.chaco.api.OverlayPlotContainer(*components, **traits)

Bases: enthought.chaco.base_plot_container.BasePlotContainer

A plot container that stretches all its components to fit within its space. All of its components must therefore be resizable.

Traits:

draw_order : Instance(list, args=(DEFAULT_DRAWING_ORDER))

use_backbuffer : False

Do not use an off-screen backbuffer.

get_preferred_size(components=None)

Returns the size (width,height) that is preferred for this component.

Overrides PlotComponent

HPlotContainer

class enthought.chaco.api.HPlotContainer(*components, **traits)

Bases: enthought.chaco.plot_containers.StackedPlotContainer

A plot container that stacks all of its components horizontally. Resizable components share the free space evenly. All components are stacked from according to stack_order* in the same order that they appear in the **components list.

Traits:

draw_order : Instance(list, args=(DEFAULT_DRAWING_ORDER))

stack_order : Enum(‘left_to_right’, ‘right_to_left’)

The order in which components in the plot container are laid out.

spacing : Float(0.0)

The amount of space to put between components.

valign : Enum(‘bottom’, ‘top’, ‘center’)

The vertical alignment of objects that don’t span the full height.

VPlotContainer

class enthought.chaco.api.VPlotContainer(*components, **traits)

Bases: enthought.chaco.plot_containers.StackedPlotContainer

A plot container that stacks plot components vertically.

Traits:

draw_order : Instance(list, args=(DEFAULT_DRAWING_ORDER))

stack_dimension : ‘v’

Overrides StackedPlotContainer.

other_dimension : ‘h’

Overrides StackedPlotContainer.

stack_index : 1

Overrides StackedPlotContainer.

halign : Enum(‘left’, ‘right’, ‘center’)

The horizontal alignment of objects that don’t span the full width.

stack_order : Enum(‘bottom_to_top’, ‘top_to_bottom’)

The order in which components in the plot container are laid out.

spacing : Float(0.0)

The amount of space to put between components.

GridPlotContainer

class enthought.chaco.api.GridPlotContainer(*components, **traits)

Bases: enthought.chaco.base_plot_container.BasePlotContainer

A GridPlotContainer consists of rows and columns in a tabular format.

Each cell’s width is the same as all other cells in its column, and each cell’s height is the same as all other cells in its row.

Although grid layout requires more layout information than a simple ordered list, this class keeps components as a simple list and exposes a shape trait.

Traits:

draw_order : Instance(list, args=(DEFAULT_DRAWING_ORDER))

spacing : Either(Tuple, List, Array)

The amount of space to put on either side of each component, expressed as a tuple (h_spacing, v_spacing).

valign : Enum(‘bottom’, ‘top’, ‘center’)

The vertical alignment of objects that don’t span the full height.

halign : Enum(‘left’, ‘right’, ‘center’)

The horizontal alignment of objects that don’t span the full width.

shape : Trait((0, 0), Either(Tuple, List, Array))

The shape of this container, i.e, (rows, columns). The items in components are shuffled appropriately to match this specification. If there are fewer components than cells, the remaining cells are filled in with spaces. If there are more components than cells, the remainder wrap onto new rows as appropriate.

component_grid : Property

This property exposes the underlying grid structure of the container, and is the preferred way of setting and reading its contents. When read, this property returns a Numpy array with dtype=object; values for setting it can be nested tuples, lists, or 2-D arrays. The array is in row-major order, so that component_grid[0] is the first row, and component_grid[:,0] is the first column. The rows are ordered from top to bottom.

SizePrefs()
Object to hold size preferences across spans in a particular dimension. For instance, if SizePrefs is being used for the row axis, then each element in the arrays below express sizing information about the corresponding column.
get_preferred_size(components=None)

Returns the size (width,height) that is preferred for this component.

Overrides PlotComponent.