tk/grid

The tk/grid command is used to communicate with the grid geometry manager that arranges widgets in rows and columns inside of another window, called the geometry master (or master window). The tk/grid command can have any of several forms, depending on the option argument:

(tk/grid slave ?slave ...? ?options?)
If the first argument to grid is suitable as the first slave argument to tk/grid configure, either a window name (any value starting with .) or one of the characters x or ^ (see the ``RELATIVE PLACEMENT'' section below), then the command is processed in the same way as tk/grid configure.

Relative Placement

The tk/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 tk/grid command, and the presence of the characters -, x, and ^ in tk/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 tk/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.

Corresponding Tcl/Tk command:

grid ...

© Author | Home | Sitemap