wijjit.layout.bounds.parse_margin

wijjit.layout.bounds.parse_margin(value)[source]

Parse a margin value into a normalized 4-tuple.

Parameters:

value (int or tuple of int) – Margin specification. If int, applies uniformly to all sides. If tuple, specifies (top, right, bottom, left) margins.

Returns:

Normalized 4-tuple (top, right, bottom, left)

Return type:

tuple of int

Examples

>>> parse_margin(2)
(2, 2, 2, 2)
>>> parse_margin((1, 2, 3, 4))
(1, 2, 3, 4)