Grid is one of several [Geometry Managers]. Some others are [pack] and [place]. <
> http://www.tcl.tk/man/tcl8.5/TkCmd/grid.htm : '''grid''' ''slave ?slave ...? ?options?'' : '''[grid bbox]''' ''master ?column row? ?column2 row2?'' : '''[grid columnconfigure]''' ''master index ?-option value...?'' : '''[grid configure]''' ''slave ?slave ...? ?options?'' : '''[grid forget]''' ''slave ?slave ...?'' : '''[grid info]''' ''slave'' : '''[grid location]''' ''master x y'' : '''[grid propagate]''' ''master ?boolean?'' : '''[grid remove]''' ''slave ?slave ...?'' : '''[grid rowconfigure]''' ''master index ?-option value...?'' : '''[grid size]''' ''master'' : '''[grid slaves]''' ''master ?-option value?'' If the first argument to '''grid''' is suitable as the first slave argument to '''[grid configure]'', either a window name (i.e., a value starting with “`.`”) or one of the characters “`x`” or “`^`” (see the "[http://www.tcl.tk/man/tcl8.6/TkCmd/grid.htm#M28%|%RELATIVE PLACEMENT]" section in the manual page), then the command is processed in the same way as '''[grid configure]'''. <> The [Book Practical Programming in Tcl and Tk, Fourth Edition] contains an excellent introduction to the grid command, which is available online at [http://www.beedub.com/book/]. Grid is excellent for many kinds of common GUI forms because it arranges widgets in nice rows and columns, and handles resizing quite nicely. ---- A simple example is a panel with just a few labels and entries. ====== package require Tk foreach field {Name Address City State Phone} { # Create a couple of widgets set l [label .lab$field -text $field] set e [entry .ent$field -justify right ] # Assign both to a row in the grid grid $l $e -padx 4 -pady 4 # Then adjust how they appear grid $l -sticky e grid $e -sticky ew } # X-resize is done by the entry column grid columnconfigure . 1 -weight 1 # Y-resize should be at the bottom... set lastrow [lindex [grid size .] 1] grid rowconfigure . [expr $lastrow - 1] -weight 1 ====== For a little more complex example, see [A little spreadsheet]. ---- On comp.lang.tcl, [http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/86590035a1030c71#] describes how a change between Tk 8.4 and 8.5 causes code which depends on the grid default behavior may need to be modified. The specific example is the [iwidgets] disjointlistbox, but other code may find the same issue. ---- [DKF] - The term ''Grid'' also refers to the very high end of resource sharing systems over the internet which it is likely that people will be hearing a lot more about in the future, especially in phrases like [Grid Service]s... TclGlobus is a project to allow Grid interfaces in Tcl: http://tclglobus.ligo.caltech.edu/ <> ---- **See also** * [simplified grid] ---- !!!!!! %| [Category Command] | [Category GUI] |% [Arts and Crafts of Tcl-Tk Programming] - [Tk syntax help] !!!!!!