Skip to content

Layout

GuiWidgetLayout

GuiWidgetLayout(
    *rows: Sequence[GuiWidget | GuiWidgetLayout | None | Sequence],
    spacing: int = 6,
    title: str | None = None
)

Bases: GuiWindowItem

Layout for grouping and positioning widgets

Parameters:

  • rows (Sequence[GuiWidget | GuiWidgetLayout | None | Sequence], default: () ) –

    A tuple of items to put in a row. Items can be widgets, layouts, None for spacers or Sequences (list, tuple) of all the above. If item is a Sequence, it's a column of items in the Sequence. To stretch the widget multiply it by the stretch multiplier: gui_widget_obj * 2.

  • spacing (int, default: 6 ) –

    space between layout items

  • title (str | None, default: None ) –

    Title for dock widget and position saving, set by type if None

Example

# 2 rows x 1 column
GuiWidgetLayout('2 x 1', row1_col1,
                         row2_col1)
# 1 row x 2 columns
GuiWidgetLayout('1 x 2', [row1_col1, row1_col2])
# 1 row x 3 columns with the spacer as the second and one third one widget stretched
GuiWidgetLayout('1 x 2', [row1_col1, None, row1_col3 * 2])
# 2 rows x 2 columns
GuiWidgetLayout('2 x 2', [row1_col1, row1_col2],
                         [row2_col1, row2_col2])
# 2 x 2 with second row span
GuiWidgetLayout('row span', [row1_col1, row1_col2],
                                  row2_span)
# 2 x 2 with column span
GuiWidgetLayout('column span', [col1_span, [row1_col2,
                                            row2_col2]])

Note

Calls can't be subscribed to GuiWidgetLayout. Subscribe calls to widgets instead.