Updated 2016-10-31 12:09:16 by oehhar
grid configure slave ?slave ...? ?options?

The arguments consist of the names of one or more slave windows followed by pairs of arguments that specify how to manage the slaves. The characters -, x and ^, can be specified instead of a window name to alter the default location of a slave, as described in the "RELATIVE PLACEMENT" section, below.

RELATIVE PLACEMENT edit

The grid command contains a limited set of capabilities that permit layouts to be created without specifying the row and column information for each slave. This permits slaves to be rearranged, added, or removed without the need to explicitly specify row and column information. When no column or row information is specified for a slave, default values are chosen for column, row, columnspan and rowspan at the time the slave is managed. The values are chosen based upon the current layout of the grid, the position of the slave relative to other slaves in the same grid command, and the presence of the characters -, x, and ^ in grid command where slave names are normally expected.

- : This increases the columnspan of the slave to the left. Several -'s in a row will successively increase the columnspan. A - may not follow a ^ or a x, nor may it be the first slave argument to grid configure.

x : This leaves an empty column between the slave on the left and the slave on the right.

^ : This extends the rowspan of the slave above the ^'s in the grid. The number of ^'s in a row must match the number of columns spanned by the slave above it.

An example of relative placement:
label .l1 -text "Label 1" -bg red
label .l2 -text "Label 2" -bg orange
label .l3 -text "Label 3" -bg yellow
label .l4 -text "Label 4" -bg green
label .l5 -text "Label 5" -bg blue

grid .l1 -  x .l2  -sticky nsew
grid  x .l3 -  ^   -sticky nsew
grid .l4 ^  ^  x   -sticky nsew
grid  ^  x .l5 -   -sticky nsew

# These are just to make things more obvious
grid columnconfigure . {0 1 2 3} -uniform 1 -weight 1
grid rowconfigure . {0 1 2 3} -uniform 1 -weight 1

Change parent window or geometry manager by changing the option -in edit

As described on the pack configure page, one may move a child widget to another frame or geometry manager by changing the option -in.

See also edit