Skip to content

Constants

Reference

toga.constants.Direction

Bases: Enum

The direction a given property should act.

Source code in core/src/toga/constants/__init__.py
 6
 7
 8
 9
10
class Direction(Enum):
    """The direction a given property should act."""

    HORIZONTAL = 0
    VERTICAL = 1

HORIZONTAL = 0

VERTICAL = 1

toga.constants.Baseline

Bases: Enum

The meaning of a Y coordinate when drawing text.

Source code in core/src/toga/constants/__init__.py
13
14
15
16
17
18
19
20
21
22
23
class Baseline(Enum):
    """The meaning of a Y coordinate when drawing text."""

    ALPHABETIC = auto()
    """Alphabetic baseline of the first line"""
    TOP = auto()
    """Top of text"""
    MIDDLE = auto()
    """Middle of text"""
    BOTTOM = auto()
    """Bottom of text"""

ALPHABETIC = auto()

Alphabetic baseline of the first line

TOP = auto()

Top of text

MIDDLE = auto()

Middle of text

BOTTOM = auto()

Bottom of text

toga.constants.FillRule

Bases: Enum

The rule to use when filling paths.

Source code in core/src/toga/constants/__init__.py
26
27
28
29
30
class FillRule(Enum):
    """The rule to use when filling paths."""

    EVENODD = 0
    NONZERO = 1

EVENODD = 0

NONZERO = 1

toga.constants.FlashMode

Bases: Enum

The flash mode to use when capturing photos or videos.

Source code in core/src/toga/constants/__init__.py
38
39
40
41
42
43
44
45
46
47
class FlashMode(Enum):
    """The flash mode to use when capturing photos or videos."""

    # These constant values allow `flash=True` and `flash=False` to work
    AUTO = -1
    OFF = 0
    ON = 1

    def __str__(self) -> str:
        return self.name.title()

AUTO = -1

OFF = 0

ON = 1

__str__()

Source code in core/src/toga/constants/__init__.py
46
47
def __str__(self) -> str:
    return self.name.title()

toga.constants.WindowState

Bases: Enum

The possible window states of an app.

NOTE: Some platforms do not fully support all states; see the toga.Window's platform notes for details.

Source code in core/src/toga/constants/__init__.py
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
class WindowState(Enum):
    """The possible window states of an app.

    NOTE: Some platforms do not fully support all states; see the [`toga.Window`][]'s
    platform notes for details.
    """

    NORMAL = 0
    """The `NORMAL` state represents the default state of the window or app when it is
    not in any other specific window state."""

    MINIMIZED = 1
    """`MINIMIZED` state is when the window isn't currently visible, although it will
    appear in any operating system's list of active windows.
    """

    MAXIMIZED = 2
    """The window is the largest size it can be on the screen with title bar and window
    chrome still visible.
    """

    FULLSCREEN = 3
    """`FULLSCREEN` state is when the window title bar and window chrome remain
    hidden; But app menu and toolbars remain visible.
    """

    PRESENTATION = 4
    """`PRESENTATION` state is when the window title bar, window chrome, app menu
    and toolbars all remain hidden.

    A good example is a slideshow app in presentation mode - the only visible content
    is the slide.
    """

NORMAL = 0

The NORMAL state represents the default state of the window or app when it is not in any other specific window state.

MINIMIZED = 1

MINIMIZED state is when the window isn't currently visible, although it will appear in any operating system's list of active windows.

MAXIMIZED = 2

The window is the largest size it can be on the screen with title bar and window chrome still visible.

FULLSCREEN = 3

FULLSCREEN state is when the window title bar and window chrome remain hidden; But app menu and toolbars remain visible.

PRESENTATION = 4

PRESENTATION state is when the window title bar, window chrome, app menu and toolbars all remain hidden.

A good example is a slideshow app in presentation mode - the only visible content is the slide.