Expanding a grid - Tcl/Tk
Archive - Originally posted on "The Horse's Mouth" - 2007-09-07 05:42:42 - Graham Ellis
label .title -text "This is a label" -relief ridge
frame .boxes
label .boxes.tl -text A -relief sunken
label .boxes.tr -text B -relief raised
label .boxes.bl -text C -relief flat
button .boxes.br -text D -relief groove -command exit
pack .title .boxes -fill both -expand yes
grid .boxes.tl .boxes.tr -sticky news
grid .boxes.bl .boxes.br -sticky news
The problem lies in the fact that Tk doesn't know HOW to expand the grid.

Here are the extra 3 lines of code:
grid rowconfigure .boxes {0 1} -weight 1
grid columnconfigure .boxes 0 -weight 3
grid columnconfigure .boxes 1 -weight 1
This example is also useful to illustrate some of the different decoration types - "reliefs" - that can be applied to widgets. In a production piece of code, you would use only one or two of them - this training example is illustrative but will make the "look and feel" team shudder!