Options

The following options can be used with the grid and grid_configure methods:

Table 27-2. Grid Manager Options

Option

Type

Description

column

integer

Insert the widget at this column. Column numbers start with 0. If omitted, defaults to 0.

columnspan

integer

If given, indicates that the widget cell should span more than one column.

in (in_)

widget

Place widget inside to the given widget. You can only place a widget inside its parent, or in any decendant of its parent. If this option is not given, it defaults to the parent.

Note that in is a reserved word in Python. To use it as a keyword option, append an underscore (in_).

ipadx, ipady

distance

Optional internal padding. Works like padx and pady, but the padding is added inside the widget borders. Default is 0.

padx, pady

distance

Optional padding to place around the widget in a cell. Default is 0.

row

integer

Insert the widget at this row. Row numbers start with 0. If omitted, defaults to the first empty row in the grid.

rowspan

integer

If given, indicates that the widget cell should span more than one row.

sticky

constant

Defines how to expand the widget if the resulting cell is larger than the widget itself. This can be any combination of the constants S, N, E, and W, or NW, NE, SW, and SE. For example, W (west) means that the widget should be aligned to the left cell border. W+E means that the widget should be stretched horizontally to fill the whole cell. W+E+N+S means that the widget should be expanded in both directions. Default is to center the widget in the cell.