wijjit.layout.engine.VStack

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

Vertical stacking container.

Arranges children vertically with optional spacing.

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

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

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

  • 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 (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

__init__(children=None, width='fill', height='fill', 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 bounds to container and position children vertically.

calculate_constraints()

Calculate constraints for vertical stack.

collect_elements()

Collect all elements from children.

get_height_for_width(width)

Sum the children's heights at the widths this column would give them.

calculate_constraints()[source]

Calculate constraints for vertical stack.

Width is the maximum of children widths. Height is the sum of children heights plus spacing.

Returns:

Calculated constraints

Return type:

SizeConstraints

get_height_for_width(width)[source]

Sum the children’s heights at the widths this column would give them.

Parameters:

width (int) – The width this stack will be laid out at.

Returns:

Rows the column needs, including spacing, padding and margins.

Return type:

int

assign_bounds(x, y, width, height)[source]

Assign bounds to container and position children vertically.

Parameters:
  • x (int) – X position

  • y (int) – Y position

  • width (int) – Assigned width

  • height (int) – Assigned height

Return type:

None