:right-sidebar: True GridLayout =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: GridLayout(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.LayoutManager`, :class:`~gi.repository.GObject.Object` ``GtkGridLayout`` is a layout manager which arranges child widgets in rows and columns. Children have an "attach point" defined by the horizontal and vertical index of the cell they occupy; children can span multiple rows or columns. The layout properties for setting the attach points and spans are set using the :obj:`~gi.repository.Gtk.GridLayoutChild` associated to each child widget. The behaviour of ``GtkGridLayout`` when several children occupy the same grid cell is undefined. ``GtkGridLayout`` can be used like a ``GtkBoxLayout`` if all children are attached to the same row or column; however, if you only ever need a single row or column, you should consider using ``GtkBoxLayout``. Constructors ------------ .. rst-class:: interim-class .. class:: GridLayout :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.LayoutManager Creates a new ``GtkGridLayout``. Methods ------- .. rst-class:: interim-class .. class:: GridLayout :no-index: .. method:: get_baseline_row() -> int Retrieves the row set with :func:`~gi.repository.Gtk.GridLayout.set_baseline_row`. .. method:: get_column_homogeneous() -> bool Checks whether all columns of ``grid`` should have the same width. .. method:: get_column_spacing() -> int Retrieves the spacing set with :func:`~gi.repository.Gtk.GridLayout.set_column_spacing`. .. method:: get_row_baseline_position(row: int) -> ~gi.repository.Gtk.BaselinePosition Returns the baseline position of ``row``. If no value has been set with :obj:`~gi.repository.Gtk.GridLayout.set_row_baseline_position`, the default value of :const:`~gi.repository.Gtk.BaselinePosition.CENTER` is returned. :param row: a row index .. method:: get_row_homogeneous() -> bool Checks whether all rows of ``grid`` should have the same height. .. method:: get_row_spacing() -> int Retrieves the spacing set with :func:`~gi.repository.Gtk.GridLayout.set_row_spacing`. .. method:: set_baseline_row(row: int) -> None Sets which row defines the global baseline for the entire grid. Each row in the grid can have its own local baseline, but only one of those is global, meaning it will be the baseline in the parent of the ``grid``. :param row: the row index .. method:: set_column_homogeneous(homogeneous: bool) -> None Sets whether all columns of ``grid`` should have the same width. :param homogeneous: :const:`True` to make columns homogeneous .. method:: set_column_spacing(spacing: int) -> None Sets the amount of space to insert between consecutive columns. :param spacing: the amount of space between columns, in pixels .. method:: set_row_baseline_position(row: int, pos: ~gi.repository.Gtk.BaselinePosition) -> None Sets how the baseline should be positioned on ``row`` of the grid, in case that row is assigned more space than is requested. :param row: a row index :param pos: a ``GtkBaselinePosition`` .. method:: set_row_homogeneous(homogeneous: bool) -> None Sets whether all rows of ``grid`` should have the same height. :param homogeneous: :const:`True` to make rows homogeneous .. method:: set_row_spacing(spacing: int) -> None Sets the amount of space to insert between consecutive rows. :param spacing: the amount of space between rows, in pixels Properties ---------- .. rst-class:: interim-class .. class:: GridLayout :no-index: .. attribute:: props.baseline_row :type: int The row to align to the baseline, when ``GtkWidget:valign`` is set to :const:`~gi.repository.Gtk.Align.BASELINE`. .. attribute:: props.column_homogeneous :type: bool Whether all the columns in the grid have the same width. .. attribute:: props.column_spacing :type: int The amount of space between to consecutive columns. .. attribute:: props.row_homogeneous :type: bool Whether all the rows in the grid have the same height. .. attribute:: props.row_spacing :type: int The amount of space between to consecutive rows.