enaml.widgets.container

Classes

Container

A Frame subclass which provides child layout functionality.

class enaml.widgets.container.Container(parent=None, **kwargs)[source]

Bases: Frame, ContentsConstrainableMixin

A Frame subclass which provides child layout functionality.

The Container is the canonical component used to arrange child widgets using constraints-based layout. The developer can supply a list of constraints on the container which specify how to layout it’s child widgets.

There are widgets whose boundaries constraints may not cross. Some examples of these would be a ScrollArea or a Notebook. See the documentation of a given widget as to whether or not constraints may cross its boundaries.

share_layout

A boolean which indicates whether or not to allow the layout ownership of this container to be transferred to an ancestor. This is False by default, which means that every container get its own layout solver. This improves speed and reduces memory use (by keeping a solver’s internal tableaux small) but at the cost of not being able to share constraints across Container boundaries. This flag must be explicitly marked as True to enable sharing.

padding

A box object which holds the padding for this component. The padding is the amount of space between the outer boundary box and the content box. The default padding is 10 pixels a side. Certain subclasses, such as GroupBox, may provide additional margin than what is specified by the padding.

resist_width

A Container does not generate constraints for its size hint by default. The minimum and maximum size constraints are sufficient to supply size limits and make for the most natural interaction between nested containers.

resist_height

How strongly a widget resists clipping its height hint. This is equivalent to the constraint:

(height >= hint) | resist_height
hug_width

How strongly a widget hugs it’s width hint. This is equivalent to the constraint:

(width == hint) | hug_width
hug_height

How strongly a widget hugs it’s height hint. This is equivalent to the constraint:

(height == hint) | hug_height
proxy

A reference to the ProxyContainer object.

widgets()[source]

Get the child ConstraintsWidgets defined on the container.

visible_widgets()[source]

Get the visible child ConstraintsWidgets on the container.

child_added(child)[source]

Handle the child added event on the container.

This event handler will request a relayout if the added child is an instance of ‘ConstraintsWidget’.

child_moved(child)[source]

Handle the child moved event on the container.

This event handler will request a relayout if the moved child is an instance of ‘ConstraintsWidget’.

child_removed(child)[source]

Handle the child removed event on the container.

This event handler will request a relayout if the removed child is an instance of ‘ConstraintsWidget’.

layout_constraints()[source]

The constraints generation for a Container.

This method supplies default vbox constraints to the visible children of the container unless the user has given explicit ‘constraints’.

This method may also be overridden from Enaml syntax.

activated

An event fired when an object’s proxy is activated. It is triggered once during the object lifetime, at the end of the activate_proxy method.

background

The background color of the widget.

destroyed

An event fired when an object has been destroyed. It is triggered once during the object lifetime, just before the object is removed from the tree structure.

enabled

Whether or not the widget is enabled.

features

Set the extra features to enable for this widget. This value must be provided when the widget is instantiated. Runtime changes to this value are ignored.

font

The font used for the widget.

foreground

The foreground color of the widget.

initialized

An event fired when an object is initialized. It is triggered once during the object lifetime, at the end of the initialize method.

maximum_size

The maximum size for the widget. The default means that the client should determine an intelligent maximum size.

minimum_size

The minimum size for the widget. The default means that the client should determine an intelligent minimum size.

name

Export the ‘name’ attribute as a declarative member.

status_tip

The status tip to show when the user hovers over the widget.

style_class

The style class to which this item belongs. Multiple classes can be separated with whitespace. An empty string indicates the widget does not belong to any style class.

tool_tip

The tool tip to show when the user hovers over the widget.