Label¶
Usage¶
import toga
label = toga.Label("Hello world")
Notes¶
- Winforms does not support a text alignment value of
JUSTIFIED. If this alignment value is used, the label will default to left alignment.
Reference¶
Bases: Widget
Source code in core/src/toga/widgets/label.py
8 9 10 11 12 13 14 15 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 | |
text
property
writable
¶
The text displayed by the label.
None, and the Unicode codepoint U+200B (ZERO WIDTH SPACE), will be
interpreted and returned as an empty string. Any other object will be
converted to a string using str().
__init__(text, id=None, style=None, **kwargs)
¶
Create a new text label.
:param text: Text of the label. :param id: The ID for the widget. :param style: A style object. If no style is provided, a default style will be applied to the widget. :param kwargs: Initial style properties.
Source code in core/src/toga/widgets/label.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
focus()
¶
No-op; Label cannot accept input focus.
Source code in core/src/toga/widgets/label.py
31 32 33 | |