enable.constraints_container module

class enable.constraints_container.ConstraintsContainer(*components, **traits)[source]

Bases: enable.container.Container

A Container which lays out its child components using a constraints-based layout solver.

do_layout(size=None, force=False)[source]

Make sure child components get a chance to refresh their layout.

refresh()[source]

Re-run the constraints solver in response to a resize or constraints modification.

relayout()[source]

Explicitly regenerate the container’s constraints and refresh the layout.

transfer_layout_ownership(owner)[source]

A method which can be called by other components in the hierarchy to gain ownership responsibility for the layout of the children of this container. By default, the transfer is allowed and is the mechanism which allows constraints to cross widget boundaries. Subclasses should reimplement this method if different behavior is desired.

Parameters

owner (ConstraintsContainer) – The container which has taken ownership responsibility for laying out the children of this component. All relayout and refresh requests will be forwarded to this component.

Returns

results – True if the transfer was allowed, False otherwise.

Return type

bool

will_transfer()[source]

Whether or not the container expects to transfer its layout ownership to its parent.

This method is predictive in nature and exists so that layout managers are not senslessly created during the bottom-up layout initialization pass. It is declared public so that subclasses can override the behavior if necessary.