Divider#
A separator used to visually distinguish two sections of content in a layout.

Usage#
To separate two labels stacked vertically with a horizontal line:
import toga
from toga.style import Pack, COLUMN
box = toga.Box(
children=[
toga.Label("First section"),
toga.Divider(),
toga.Label("Second section"),
],
style=Pack(direction=COLUMN, flex=1, padding=10)
)
The direction (horizontal or vertical) can be given as an argument. If not specified, it will default to horizontal.
Reference#
- class toga.widgets.divider.Divider(id=None, style=None, direction=HORIZONTAL)#
Create a new divider line.
Inherits from
Widget
.- Parameters:
id – The ID for the widget.
style – A style object. If no style is provided, a default style will be applied to the widget.
direction – The direction in which the divider will be drawn. Defaults to
Divider.HORIZONTAL
- HORIZONTAL = 0#
- VERTICAL = 1#
- property direction#
The direction in which the visual separator will be drawn.
- Returns:
Divider.HORIZONTAL
orDivider.VERTICAL
- property enabled#
Is the widget currently enabled? i.e., can the user interact with the widget?
Divider widgets cannot be disabled; this property will always return True; any attempt to modify it will be ignored.
- focus()#
No-op; Divider cannot accept input focus