wijjit.layout.bounds.Size

class wijjit.layout.bounds.Size(value)[source]

Represents a size specification for layout calculation.

This can represent fixed sizes, percentages, or fill behavior.

Parameters:

value (int or str) – Size value (integer for fixed, “fill” for remaining space, or percentage string like “50%”)

Variables:

value (int or str) – The size specification

__init__(value)
Parameters:

value (int | str)

Return type:

None

Methods

__init__(value)

calculate(available)

Calculate the actual size given available space.

get_percentage()

Get the percentage value (0.0 to 1.0).

Attributes

is_fill

Check if this should fill available space.

is_fixed

Check if this is a fixed size.

is_percentage

Check if this is a percentage size.

value

value: int | str
property is_fixed: bool

Check if this is a fixed size.

Returns:

True if fixed size

Return type:

bool

property is_fill: bool

Check if this should fill available space.

Returns:

True if fill mode

Return type:

bool

property is_percentage: bool

Check if this is a percentage size.

Returns:

True if percentage

Return type:

bool

get_percentage()[source]

Get the percentage value (0.0 to 1.0).

Returns:

Percentage as decimal

Return type:

float

Raises:

ValueError – If not a percentage size

calculate(available)[source]

Calculate the actual size given available space.

Parameters:

available (int) – Available space

Returns:

Calculated size

Return type:

int

__repr__()[source]

String representation of size.

Returns:

String representation

Return type:

str