vispy.scene.widgets.grid module

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

Bases: vispy.scene.widgets.widget.Widget

Widget that automatically sets the position and size of child Widgets to proportionally divide its internal area into a grid.

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)[source]

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)[source]

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)[source]

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()[source]
remove_widget(widget)[source]

Remove a widget from this grid

Parameters
widgetWidget

The Widget to remove

resize_widget(widget, row_span, col_span)[source]

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.