Skip to content

textual.geometry

Functions and classes to manage terminal geometry (anything involving coordinates or dimensions).

NULL_OFFSET module-attribute

NULL_OFFSET = Offset(0, 0)

An [offset][textual.geometry.Offset] constant for (0, 0).

NULL_REGION module-attribute

NULL_REGION = Region(0, 0, 0, 0)

A [Region][textual.geometry.Region] constant for a null region (at the origin, with both width and height set to zero).

NULL_SIZE module-attribute

NULL_SIZE = Size(0, 0)

A [Size][textual.geometry.Size] constant for a null size (with zero area).

NULL_SPACING module-attribute

NULL_SPACING = Spacing(0, 0, 0, 0)

A [Spacing][textual.geometry.Spacing] constant for no space.

SpacingDimensions module-attribute

SpacingDimensions = Union[
    int,
    Tuple[int],
    Tuple[int, int],
    Tuple[int, int, int, int],
]

The valid ways in which you can specify spacing.

clamp

Restrict a value to a given range.

If value is less than the minimum, return the minimum. If value is greater than the maximum, return the maximum. Otherwise, return value.

The minimum and maximum arguments values may be given in reverse order.

Parameters:

Name Type Description Default

value

T

A value.

required

minimum

T

Minimum value.

required

maximum

T

Maximum value.

required

Returns:

Type Description
T

New value that is not less than the minimum or greater than the maximum.