wijjit.layout.engine.ElementNode

class wijjit.layout.engine.ElementNode(element, width='auto', height='auto')[source]

Layout node wrapping a single Element.

Parameters:
  • element (Element) – The element to wrap

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

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

Variables:

element (Element) – The wrapped element

__init__(element, width='auto', height='auto')[source]
Parameters:
Return type:

None

Methods

__init__(element[, width, height])

assign_bounds(x, y, width, height)

Assign bounds to this node and its element.

calculate_constraints()

Calculate size constraints based on element content.

collect_elements()

Return the wrapped element and any nested children.

get_height_for_width(width)

Re-measure the wrapped element against its settled width.

calculate_constraints()[source]

Calculate size constraints based on element content.

For now, uses simple heuristics. Elements can override this by providing their own size hints.

Returns:

Calculated constraints

Return type:

SizeConstraints

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

Assign bounds to this node and its element.

Parameters:
  • x (int) – X position

  • y (int) – Y position

  • width (int) – Assigned width

  • height (int) – Assigned height

Return type:

None

get_height_for_width(width)[source]

Re-measure the wrapped element against its settled width.

Parameters:

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

Returns:

Rows the element needs at width.

Return type:

int

collect_elements()[source]

Return the wrapped element and any nested children.

Returns:

List containing the element and any nested children it contains

Return type:

list of Element

Notes

If the element has a collect_child_elements() method (e.g., TabbedPanel), those nested elements are also included for focus/mouse event routing.