wijjit.layout.engine.Container

class wijjit.layout.engine.Container(children=None, width='auto', height='auto', spacing=0, padding=0, margin=0, align_h='stretch', align_v='stretch', id=None)[source]

Base container class for layout nodes with children.

Parameters:
  • children (list of LayoutNode, optional) – Child nodes

  • width (int, str, or Size, optional) – Width specification (default: “auto”)

  • height (int, str, or Size, optional) – Height specification (default: “auto”)

  • spacing (int, optional) – Spacing between children (default: 0)

  • padding (int, optional) – Padding around children (default: 0)

  • margin (int or tuple of int, optional) – Margin around container. If int, applies uniformly to all sides. If tuple, specifies (top, right, bottom, left) margins. (default: 0)

  • align_h ({"left", "center", "right", "stretch"}, optional) – Horizontal alignment of children (default: “stretch”)

  • align_v ({"top", "middle", "bottom", "stretch"}, optional) – Vertical alignment of children (default: “stretch”)

  • id (str, optional) – Node identifier

Variables:
  • children (list of LayoutNode) – Child nodes

  • spacing (int) – Spacing between children

  • padding (int) – Padding around children

  • margin (tuple of int) – Margin (top, right, bottom, left)

  • align_h (str) – Horizontal alignment

  • align_v (str) – Vertical alignment

__init__(children=None, width='auto', height='auto', spacing=0, padding=0, margin=0, align_h='stretch', align_v='stretch', id=None)[source]
Parameters:
Return type:

None

Methods

__init__([children, width, height, spacing, ...])

add_child(child)

Add a child node.

assign_bounds(x, y, width, height)

Assign absolute position and size (top-down pass).

calculate_constraints()

Calculate size constraints (bottom-up pass).

collect_elements()

Collect all elements from children.

get_height_for_width(width)

Return the height this node needs when laid out at width.

add_child(child)[source]

Add a child node.

Parameters:

child (LayoutNode) – Child node to add

Return type:

None

collect_elements()[source]

Collect all elements from children.

Returns:

All elements in the subtree

Return type:

list of Element