Label#

A text label for annotating forms or interfaces.

../../../_images/Label.jpeg
Availability (Key)#

macOS

GTK

Windows

iOS

Android

Web

Usage#

import toga

label = toga.Label("Hello world")

Notes#

  • Winforms does not support an alignment value of JUSTIFIED. If this alignment value is used, the label will default to left alignment.

Reference#

class toga.widgets.label.Label(text, id=None, style=None)#

Create a new text label.

Inherits from Widget.

Parameters:
  • text – Text of the label.

  • id – The ID for the widget.

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

focus()#

No-op; Label cannot accept input focus

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