Label

A text label for annotating forms or interfaces.

../../../_images/label-cocoa.png

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.Label(text, id=None, style=None)

Bases: Widget

Create a new text label.

Parameters:
  • text (str) – 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: str

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