Skip to main content
`Ctrl`+`K`

# 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: `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:
    spacing int

      Spacing between widgets.

    **kwargs dict

      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:
      row int

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

      col int

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

      row_span int

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

      col_span int

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

      **kwargs dict

        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:
      row int

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

      col int

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

      row_span int

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

      col_span int

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

      **kwargs dict

        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:
      widget Widget | None

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

      row int

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

      col int

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

      row_span int

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

      col_span int

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

      **kwargs dict

        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:
      widget Widget

        The Widget to remove

  resize_widget(widget, row_span, col_span)

    Resize a widget in the grid to new dimensions.

    Parameters:
      widget Widget

        The widget to resize

      row_span int

        The number of rows to be occupied by this widget.

      col_span int

        The number of columns to be occupied by this widget.