Skip to content
Toga
0.5.3.dev143+gabcc6cdb6

Divider

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

/reference/images/divider-cocoa.png

/reference/images/divider-gtk.png

/reference/images/divider-winforms.png

/reference/images/divider-android.png

/reference/images/divider-iOS.png

Screenshot not available

Not supported

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"),
    ],
    direction=COLUMN,
    flex=1,
    margin=10
)

The direction (horizontal or vertical) can be given as an argument. If not specified, it will default to horizontal.

Reference

toga.Divider

Divider(id=None, style=None, direction=HORIZONTAL, **kwargs)

Bases: Widget

Create a new divider line.

PARAMETER DESCRIPTION
id

The ID for the widget.

TYPE: str | None DEFAULT: None

style

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

TYPE: StyleT | None DEFAULT: None

direction

The direction in which the divider will be drawn. Either Direction.HORIZONTAL or Direction.VERTICAL; defaults to Direction.HORIZONTAL

TYPE: Direction DEFAULT: HORIZONTAL

kwargs

Initial style properties.

DEFAULT: {}

direction property writable

direction

The direction in which the visual separator will be drawn.

enabled property writable

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

focus()

No-op; Divider cannot accept input focus.