Skip to content
Toga
0.5.3.dev143+gabcc6cdb6

Label

A text label for annotating forms or interfaces.

/reference/images/label-cocoa.png

/reference/images/label-gtk.png

/reference/images/label-winforms.png

/reference/images/label-android.png

/reference/images/label-iOS.png

/reference/images/label-web.png

Screenshot not available

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

toga.Label

Label(text, id=None, style=None, **kwargs)

Bases: Widget

Create a new text label.

PARAMETER DESCRIPTION
text

Text of the label.

TYPE: str

id

The ID for the widget.

TYPE: str | None DEFAULT: None

style

A style object. If no style is provided, a default style will be applied to the widget.

TYPE: StyleT | None DEFAULT: None

kwargs

Initial style properties.

DEFAULT: {}

text property writable

text

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().

focus

focus()

No-op; Label cannot accept input focus.