Layouts

class Layout

Base class of all layouts.

property margin

The margin of the layout.

Type

int

property spacing

The spacing of the layout.

Type

int

class GridLayout(parent=None, rows=1, columns=1, spacing=- 1)

Base class: Layout

The GridLayout class lays out widgets in a grid.

Parameters
  • parent (Widget) -- The parent Widget.

  • rows (int) -- The number of rows of the grid.

  • columns (int) -- The number of columns of the grid.

  • spacing (int) -- The spacing of the layout.

property column_count

The number of columns in the grid.

Type

int, read-only

property row_count

The number of rows in the grid.

Type

int, read-only

add_layout(item, row, column)

Adds a layout to the layout in the specified row and column.

Parameters
  • item (Layout) -- The layout that will be added to the grid.

  • row (int) -- The row where the layout will be added.

  • column (int) -- The column where the layout will be added.

add_widget(item, row, column)

Adds a widget to the layout in the specified row and column.

Parameters
  • item (Widget) -- The widget that will be added to the grid.

  • row (int) -- The row where the layout will be added.

  • column (int) -- The column where the layout will be added.

class HBox(parent=None, spacing=0, margin=0)

Base class: Layout

The HBox class lines up widgets horizontally.

Parameters
  • parent (Widget) -- The parent Widget.

  • spacing (int) -- The spacing of the layout.

  • margin (int) -- The space between the border of the layout and the widgets inside.

add_layout(item, stretch=0)

Adds another layout to the box.

Parameters
  • item (Layout) -- The layout that will be added to the box.

  • stretch (int) -- How the layout will react when the box is resized.

add_widget(item, stretch=0, alignment=Position.CENTER)

Adds a widget to the layout.

Parameters
  • item (Widget) -- The widget that will be added to the box.

  • stretch (int) -- How the layout will react when the box is resized.

  • alignment (Position) -- The alignment of the widget.

insert_spacing(index, size)

Adds a widget to the layout.

Parameters
  • index (int) -- The index in the box where the space will be inserted.

  • size (int) -- The amount of spacing to add.

class VBox(parent=None, spacing=0, margin=0)

Base class: Layout

The VBox class lines up widgets vertically.

Parameters
  • parent (Widget) -- The parent Widget.

  • spacing (int) -- The spacing of the layout.

  • margin (int) -- The space between the border of the layout and the widgets inside.

add_layout(item, stretch=0)

Adds another layout to the box.

Parameters
  • item (Layout) -- The layout that will be added to the box.

  • stretch (int) -- How the layout will react when the box is resized.

add_widget(item, stretch=0, alignment=Position.CENTER)

Adds a widget to the layout.

Parameters
  • item (Widget) -- The widget that will be added to the box.

  • stretch (int) -- How the layout will react when the box is resized.

  • alignment (Position) -- The alignment of the widget.

insert_spacing(index, size)

Adds a widget to the layout.

Parameters
  • index (int) -- The index in the box where the space will be inserted.

  • size (int) -- The amount of spacing to add.