Source code for simvx.core.alignment
"""Alignment enums shared by text drawing, labels and containers."""
from enum import StrEnum
__all__ = ["HAlign", "VAlign"]
[docs]
class HAlign(StrEnum):
"""Horizontal alignment: where content sits across the width it is given.
One type for every horizontal alignment in the engine: ``Label.alignment``,
``Text3D.alignment``, ``VBoxContainer.alignment`` and ``align=`` on
``renderer.text``. Each accepts the member or its plain string, so
``label.alignment = "centre"`` and ``label.alignment = HAlign.CENTRE`` are
the same assignment.
"""
LEFT = "left"
CENTRE = "centre"
RIGHT = "right"
[docs]
class VAlign(StrEnum):
"""Vertical alignment: where content sits down the height it is given.
The vertical counterpart of :class:`HAlign`, used by
``Label.vertical_alignment``, ``HBoxContainer.alignment`` and ``valign=``
on ``renderer.text``. Each accepts the member or its plain string.
"""
TOP = "top"
CENTRE = "centre"
BOTTOM = "bottom"