enums
This module provides commonly used enumerations for the library.
It also has a class implementing Enum-s with default values. All Enums
below subclass it, meaning you can use their get_default()
methods to get
the globally set default value.
To modify defaults, use the defaults
dictionary.
CenteringPolicy
Bases: DefaultEnum
Policies to center Container
according to.
Source code in pytermgui/enums.py
59 60 61 62 63 64 |
|
DefaultEnum
Bases: IntEnum
An Enum class that can return its default value.
Source code in pytermgui/enums.py
35 36 37 38 39 40 41 42 |
|
get_default()
classmethod
Get default value
Source code in pytermgui/enums.py
38 39 40 41 42 |
|
HorizontalAlignment
Bases: DefaultEnum
Policies to align widgets by.
These are applied by the parent object, and are relative to them.
Source code in pytermgui/enums.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
CENTER = 1
class-attribute
instance-attribute
Center widget in the available width.
LEFT = 0
class-attribute
instance-attribute
Align widget to the left edge.
RIGHT = 2
class-attribute
instance-attribute
Align widget to the right edge.
Overflow
Bases: DefaultEnum
Overflow policies implemented by Container.
Source code in pytermgui/enums.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
AUTO = 9999
class-attribute
instance-attribute
NotImplemented
HIDE = 0
class-attribute
instance-attribute
Stop gathering lines once there is no room left.
RESIZE = 2
class-attribute
instance-attribute
Resize parent to fit with the new lines.
Note
When applied to a window, this prevents resizing its height using the bottom border.
SCROLL = 1
class-attribute
instance-attribute
Allow scrolling when there is too many lines.
SizePolicy
Bases: DefaultEnum
Values according to which Widget sizes are assigned.
Source code in pytermgui/enums.py
45 46 47 48 49 50 51 52 53 54 55 56 |
|
FILL = 0
class-attribute
instance-attribute
Inner widget will take up as much width as possible.
RELATIVE = 2
class-attribute
instance-attribute
Inner widget will take up widget.relative_width * available space.
STATIC = 1
class-attribute
instance-attribute
Inner widget will take up an exact amount of width.
VerticalAlignment
Bases: DefaultEnum
Vertical alignment options for widgets.
Source code in pytermgui/enums.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
BOTTOM = 2
class-attribute
instance-attribute
Align widgets to the bottom.
CENTER = 1
class-attribute
instance-attribute
Align widgets in the center, with equal* padding on the top and bottom.
Note
When the available height is not divisible by 2, the extra line of padding is added to the bottom.
TOP = 0
class-attribute
instance-attribute
Align widgets to the top
WidgetChange
Bases: Enum
The type of change that happened within a widget.
Source code in pytermgui/enums.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
HEIGHT = _auto()
class-attribute
instance-attribute
The height of the widget changed, possibly involving LINES type changes.
LINES = _auto()
class-attribute
instance-attribute
The result of get_lines
has changed, but size changes didn't happen.
SIZE = _auto()
class-attribute
instance-attribute
Both WIDTH and HEIGHT has changed.
WIDTH = _auto()
class-attribute
instance-attribute
The width of the widget changed, possibly involving LINES type changes.