collapsible
The Collapsible widget type.
Collapsible
Bases: Container
A collapsible section of UI.
Source code in pytermgui/widgets/collapsible.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 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 110 |
|
__init__(label, *items, keyboard=False, **attrs)
Initializes the widget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label |
str
|
The label for the trigger toggle. |
required |
*items |
Any
|
The items that will be hidden when the object is collapsed. |
()
|
keyboard |
bool
|
If set, the first character of the label will be used as
a |
False
|
Source code in pytermgui/widgets/collapsible.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
collapse()
Collapses the dropdown.
Does nothing if already collapsed.
Returns:
Type | Description |
---|---|
Collapsible
|
This object. |
Source code in pytermgui/widgets/collapsible.py
84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
expand()
Expands the dropdown.
Does nothing if already expanded.
Returns:
Type | Description |
---|---|
Collapsible
|
This object. |
Source code in pytermgui/widgets/collapsible.py
98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
toggle()
Toggles expanded state.
Returns:
Type | Description |
---|---|
Collapsible
|
This object. |
Source code in pytermgui/widgets/collapsible.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|