S or /

SourceClass Grid

from egui import Grid
class Grid:

A simple grid layout.

The cells are always laid out left to right, top-down. The contents of each cell will be aligned to the left and center.

If you want to add multiple widgets to a cell you need to group them with Ui.horizontal, Ui.vertical etc.

Methods§

Sourcedef max_col_width(self, /, max_col_width: float) -> Grid§

Set soft maximum width (wrapping width) of each column.

Sourcedef min_col_width(self, /, min_col_width: float) -> Grid§

Set minimum width of each column. Default: egui.style.Spacing.interact_size.x.

Sourcedef min_row_height(self, /, min_row_height: float) -> Grid§

Set minimum height of each row. Default: egui.style.Spacing.interact_size.y.

Sourcedef num_columns(self, /, num_columns: int) -> Grid§

Setting this will allow the last column to expand to take up the rest of the space of the parent Ui.

Sourcedef show(self, /) -> Any§

To show a Grid, call .show() wrapped within async with (...) as grid_ui:. You can use another variable name instead of grid_ui. You can then create widgets inside the Grid's ui as if it was a regular ui.

Source
Sourcedef spacing(self, /, spacing: Vec2) -> Grid§

Set spacing between columns/rows. Default: egui.style.Spacing.item_spacing.

Sourcedef start_row(self, /, start_row: int) -> Grid§

Change which row number the grid starts on. This can be useful when you have a large egui.Grid inside of egui.ScrollArea.show_rows.

Sourcedef striped(self, /, striped: bool) -> Grid§

If True, add a subtle background color to every other row.

This can make a table easier to read. Default is whatever is in egui.Visuals.striped.

Sourcedef with_row_color(self, /, color_picker: Any) -> Grid§

Setting this will allow for dynamic coloring of rows of the grid object