Divider#

Availability (Key)#

macOS

GTK

Windows

iOS

Android

Web

The divider is used to visually separate sections of a user layout with a line.

Usage#

Simple usage to separate two labels in a column:

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, factory=None)#

A visual divider line.

Parameters:
  • id (str) – An identifier for this widget.

  • style (Style) – An optional style object. If no style is provided then a new one will be created for the widget.

  • direction – The direction for divider, either Divider.HORIZONTAL or Divider.VERTICAL. Defaults to Divider.HORIZONTAL`

HORIZONTAL = 0#
VERTICAL = 1#
property direction#

The direction of the split.

Returns:

0 for vertical, 1 for horizontal.