text
Widget that's just text.
Parameters : type | Description | Required/Default |
---|---|---|
text : str |
text inside Widget | Required |
wrap: int |
the length of the lines to which the text will be wrapped | 35 |
Just an empty space.
Parameters : type | Description | Required/Default |
---|---|---|
size: list<int> |
size of the empty space in format [WIDTH : int, HEIGHT : int] |
Required |
-------
|child|
-------
|child|
-------
------
|child
------
Widget that wraps another widget with a thin border.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget that is wrapped with border | Required |
border: List<bool> |
specifies on which side would be border. [TOP: bool, RIGTH: bool, BOTTOM: bool, LEFT: bool] |
Required |
=========
||child||
=========
||child||
=========
=======
||child
=======
Widget that wraps another widget with a thick border.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget that is wrapped with border | Required |
=title=====
Lorem Ipsum
Widget that adds title decorated with thick line to another widget.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget which is added title | Required |
title : TextWidget |
title that is added to widget | Required |
-title-----
Lorem Ipsum
Widget that adds title decorated with thin line to another widget.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget which is added title | Required |
title : TextWidget |
title that is added to widget | Required |
child
Widget that adds padding around the another widget.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget which is added padding | Required |
padding : list<int> |
size of the padding in format [TOP : int, RIGHT : int, BOTTOM : int, LEFT : int] |
Required |
-title-
|child|
-------
Widget that wraps another widget with Thin Border with title.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget which is wrapped | Required |
title : TextWidget |
title that is added to BOrder | Required |
=title===
||child||
=========
Widget that wraps another widget with Thick Border with title.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget which is wrapped | Required |
title : TextWidget |
title that is added to Border | Required |
#0 child,#1 child,#2 child,#3 child,#4 child,
Widget that place another widgets in a row.
Parameters : type | Description | Required/Default |
---|---|---|
children : list<wiget> |
list of widgets that will be placed in a row | Required |
#0 child|#1 child|#2 child|#3 child|#4 child
Widget that place another widgets in a row and separates them with thin border.
Parameters : type | Description | Required/Default |
---|---|---|
children : list<wiget> |
list of widgets that will be placed in a row | Required |
#0 child||#1 child||#2 child||#3 child||#4 child
Widget that place another widgets in a row and separates them with thick border.
Parameters : type | Description | Required/Default |
---|---|---|
children : list<wiget> |
list of widgets that will be placed in a row | Required |
#0 child
#1 child
#2 child
#3 child
#4 child
Widget that place another widgets in a column.
Parameters : type | Description | Required/Default |
---|---|---|
children : list<wiget> |
list of widgets that will be placed in a row | Required |
#0 child
--------
#1 child
--------
#2 child
--------
#3 child
--------
#4 child
Widget that place another widgets in a column and separates them with thin border.
Parameters : type | Description | Required/Default |
---|---|---|
children : list<wiget> |
list of widgets that will be placed in a row | Required |
#0 child
========
#1 child
========
#2 child
========
#3 child
========
#4 child
Widget that place another widgets in a column and separates them with thick border.
Parameters : type | Description | Required/Default |
---|---|---|
children : list<wiget> |
list of widgets that will be placed in a row | Required |
There are to ways to pass data to widget:
-
Static: Data passed with that method never changes.
-
Dynamic: If you change data passed with that method and refresh the widget, displayed data will also change.
All types all data are passed as an arguments to the Widget constructor, but the dynamic ones are passed as dictionary
returned from an anonymous function created with lambda keyword passed as dynamic_data
.
from PTUI.widgets import ThickBorderCardWidget, TextWidget
title = 'foo'
body = 'bar'
foo = ThickBorderCardWidget(
dynamic_data=lambda: {
'title': title
},
child=TextWidget(text=body)
)
If you change the title variable and refresh the widget will change it's title, but if you do the same to body variable, nothing will happen.
You can style widget by passing to it StyleData object as style parameter.
Parameters : type | Description | Required/Default |
---|---|---|
font_color : styles.Colors.FontColors.* |
font color | default console font color |
background_color : styles.Colors.BackgroundColors.* |
font background color | default console font background color |
font_brightness : styles.Colors.FontBrightness.* |
font brightness | default console font brightness |
Screen that you have to refresh manually.
Parameters : type | Description | Required/Default |
---|---|---|
child : Widget |
widget that is built and displayed | Required |
centered : bool |
specifies if widget should be in the center of terminal | True |
Function | Description | parameters |
---|---|---|
refresh | refreshes screen | None |
__str__ | returns rendered string instead of printing it | None |
Function | Description | parameters |
---|---|---|
display | display screen, which it was passed as argument | screen_id : str |
refresh | refreshes actual screen | None |
You pass Screens to Screen Manager constructor as kwargs, where key is screen id, and the value a Screen.
from PTUI.screens import ScreensManager, ManualRefreshScreen
from PTUI.widgets import TextWidget
sm = ScreensManager(
foo=ManualRefreshScreen(child=TextWidget(text='foo')),
bar=ManualRefreshScreen(child=TextWidget(text='bar')),
)