vispy.scene.widgets.grid module

Grid widget for providing a gridded layout to child widgets.

class vispy.scene.widgets.grid.Grid(spacing=6, **kwargs)

Bases: vispy.scene.widgets.widget.Widget

Widget for proportionally dividing its internal area into a grid.

This widget will automatically set the position and size of child widgets according to provided constraints.

Parameters
spacingint

Spacing between widgets.

**kwargsdict

Keyword arguments to pass to Widget.

add_grid(row=None, col=None, row_span=1, col_span=1, **kwargs)

Create a new Grid and add it as a child widget.

Parameters
rowint

The row in which to add the widget (0 is the topmost row)

colint

The column in which to add the widget (0 is the leftmost column)

row_spanint

The number of rows to be occupied by this widget. Default is 1.

col_spanint

The number of columns to be occupied by this widget. Default is 1.

**kwargsdict

Keyword arguments to pass to the new Grid.

add_view(row=None, col=None, row_span=1, col_span=1, **kwargs)

Create a new ViewBox and add it as a child widget.

Parameters
rowint

The row in which to add the widget (0 is the topmost row)

colint

The column in which to add the widget (0 is the leftmost column)

row_spanint

The number of rows to be occupied by this widget. Default is 1.

col_spanint

The number of columns to be occupied by this widget. Default is 1.

**kwargsdict

Keyword arguments to pass to ViewBox.

add_widget(widget=None, row=None, col=None, row_span=1, col_span=1, **kwargs)

Add a new widget to this grid.

This will cause other widgets in the grid to be resized to make room for the new widget. Can be used to replace a widget as well.

Parameters
widgetWidget | None

The Widget to add. New widget is constructed if widget is None.

rowint

The row in which to add the widget (0 is the topmost row)

colint

The column in which to add the widget (0 is the leftmost column)

row_spanint

The number of rows to be occupied by this widget. Default is 1.

col_spanint

The number of columns to be occupied by this widget. Default is 1.

**kwargsdict

parameters sent to the new Widget that is constructed if widget is None

Notes

The widget’s parent is automatically set to this grid, and all other parent(s) are removed.

property grid_size
property layout_array
next_row()
remove_widget(widget)

Remove a widget from this grid.

Parameters
widgetWidget

The Widget to remove

resize_widget(widget, row_span, col_span)

Resize a widget in the grid to new dimensions.

Parameters
widgetWidget

The widget to resize

row_spanint

The number of rows to be occupied by this widget.

col_spanint

The number of columns to be occupied by this widget.