class Grid(Frame)

A Grid is a container that lays out a collection of components in a two-dimensional grid.

The initial size of the container, and the width of each column and height of each row, are made just large enough to hold their contents. The horizontal and vertical alignment of components within their cells can be specified. One row and/or one column may be specified to expand when the Grid is resized.

In addition, the width and/or height of all items may optionally be equalized before they are laid out.

Note: Don't confuse this with the GridView class, which is a view providing a regular grid of user-drawn cells.


Grid(items, keyword = value, ...)
Creates a Grid containing the specified items, which should be a sequence of rows, each of which is a sequence of Components. An item may be None to leave an empty cell in the grid. The following keyword arguments may be used:
row_spacingVertical space to leave between rows.
column_spacingHorizontal space to leave between columns.
padding = (0, 0)Space to leave horizontally and vertically around all the items.
align = 'c'Alignment of items within cells. A string made up of the letters 'l', 'r', 't', 'b' and 'c' for left, right, top, bottom and centre.
equalize = ''Specifies whether to make the size of all items equal in the horizontal and/or vertical direction. One of 'w', 'h' or 'wh'.
expand_row = NoneIndex of a row whose items should change height when the container is resized. Items in rows above are anchored to the top of the container, and those in rows below are anchored to the bottom.
expand_column = NoneIndex of a column whose items should change width whent the container is resized. Items in columns to the left are anchored to the left of the container, and those in columns to the right are anchored to the right.