class Container(Component)

Container is an abstract base class for components which can contain other components. The contained components are clipped to the boundary of their container.

The Container class provides a flexible placement facility for laying out its contents and specifying how the contents behave when the container is resized.

You should not derive directly from Container. Custom components should be based on View or Frame.

Properties

contents
List of contained Components.

Do not modify the contents of this list directly. Use the placement methods, or the add and remove methods, to modify the containment hierarchy.

content_width
content_height
content_size
The size of the content area of the container. The content area is the area available to subcomponents, excluding any borders, scrollbars or other decorations that the component may have.

auto_layout
A boolean controlling whether the layout of subcomponents is automatically adjusted when the container changes size. Defaults to true.

Methods

add(component)
Adds the given component to this container.

remove(component)
If the given component is among the contents of this container, removes it.

place(item,
  left = None, right = None, top = None, bottom = None,
  sticky = 'nw', scrolling = '', border = None)

place_row(items,
  left = None, right = None, top = None, bottom = None,
  sticky = 'nw', scrolling = '',border = 
None)

place_column(items,
  left = None, right = None, top = None, bottom = None,
  sticky = 'nw', scrolling = '', border = None)

These methods add a component or list of components to the container with the specified placement options. See Placement Methods.
shrink_wrap(padding = None)
Changes the size of the container so that it neatly encloses its contents. By default it leaves the same amount of space at the right and bottom of the contents as there is at the left and top. This can be overridden by specifying a tuple (right, bottom) for padding. If the container is empty, its size is not changed.
resize(geometry_property = value, ..., auto_layout = False)
This method allows the size of the container to be changed without affecting the layout of subcomponents. It is equivalent to assigning the given values to the specified geometry properties, except that the auto_layout property setting is temporarily overridden by the given parameter.

Callbacks

resized(delta)
Called when the size of the container changes for any reason while the auto_layout property is true. The delta parameter is a tuple (dx, dy) representing the amount by which the size has changed. The default implementation calls container_resized() on each of the subcomponents.

Destructor

destroy()
Destroys the container and all its contained subcomponents.

---