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.pack 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.Divider(id=None, style=None, direction=HORIZONTAL)#
Bases:
Widget
Create a new divider line.
- 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 (
Direction
) – The direction in which the divider will be drawn. EitherHORIZONTAL
orVERTICAL
; defaults toHORIZONTAL
- HORIZONTAL = 0#
- VERTICAL = 1#
- property enabled: bool#
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