Updated 2013-11-11 15:57:28 by RLE

Just copy the script below. run it. The how-to-use explanation is on the program interface. This code is meant to teach the geometry managers pack, grid and place. This script is working 100%. The funny thing in it, if you make a mistake the Tcl parser will give you the errors, rather than me taking care of them :)
#!/usr/bin/wish


#Author: Rani Fayez Ahmad (Superlinux)
#Script Topic: Tcl/Tk Geometry Managers Demo
#Please read the variable below to know the goal of this script
set labeltext "
  You will have 5 buttons on the window toplevel once you click any of the buttons \[pack\], \[grid\], or \[place\].\n
  Those three buttons correspond to the Tcl/Tk geometry managers \[pack\], \[grid\], and \[place\].\n
  If you run \[pack\] button, it will read the options to set the \[pack\] Tcl command for 5 buttons from each of the 5 entries, \nand display them in the \[pack\] method of geometry management.\n
  If you run \[grid\] button, it will read the options to set the \[grid\] Tcl command for 5 buttons from each of the 5 entries, \nand display them in the \[grid\] method of geometry management.\n
  If you run \[place\] button, it will read the options to set the \[place\] Tcl command for 5 buttons from each of the 5 entries, \nand display them in the \[place\] method of geometry management.\n
 \nThe buttons window paths are of the form .top.b\$i , where \$i can be one of 1,2,3,4, or 5 
 "

wm title . "Tcl/Tk Geometry Managers Demo"
button .pack_button -text "\[pack\] geometry manager" -command { 
.last_geometry_manager configure  -text "Last geometry manager used \[pack\]"
      raise .top
      if  {! [winfo exists .top ]} { toplevel .top }
    for {set i 1 } { $i < 6} {incr i } {
        if  {[winfo exists .top.b$i]} { destroy .top.b$i }
        button .top.b$i -text "button $i"
        pack .top.b$i
      }  
       for {set i 1 } { $i <6 } {incr i } {
       
        set options [.fl$i.ent$i get ]
        eval "pack configure .top.b$i $options" 
        
        }
}

button .grid_button -text "\[grid\] geometry manager" -command { 
.last_geometry_manager configure  -text "Last geometry manager used \[grid\]"
if  {! [winfo exists .top ]} { toplevel .top }
raise .top
    for {set i 1 } { $i < 6} {incr i } {
        if  {[winfo exists .top.b$i]} { destroy .top.b$i }
        button .top.b$i -text "button $i"
        grid .top.b$i
      }  
       for {set i 1 } { $i < 6} {incr i } {
              
        set options [.fl$i.ent$i get ]
        eval "grid configure .top.b$i $options" 
        
        }


}
button .place_button -text "\[place\] geometry manager" -command { 
.last_geometry_manager configure  -text "Last geometry manager used \[place\]"
if  {! [winfo exists .top ]} { toplevel .top }
raise .top
for {set i 1 } { $i < 6} {incr i } {
        if  {[winfo exists .top.b$i]} { destroy .top.b$i }
        button .top.b$i -text "button $i"
        place .top.b$i -y [expr $i*30]
      }  
       for {set i 1 } { $i < 6} {incr i } {
        
        set options [.fl$i.ent$i get ]
        eval "place configure .top.b$i $options" 
        
        }



}



for {set i 1 } { $i < 6} {incr i} {
labelframe .fl$i -text "button $i options entry"
entry .fl$i.ent$i  -width 50
}

pack [label .last_geometry_manager -text "No geometry manager has been used yet!"]

pack .pack_button .grid_button .place_button 
for {set i 1 } { $i < 6} {incr i } {
pack .fl$i .fl$i.ent$i
}



toplevel .top


labelframe .fl_howto -text "How to use this program:"
label .fl_howto.lab -text $labeltext -justify left
pack .fl_howto .fl_howto.lab
button .top.b -text buttton
pack .top.b
destroy .top.b