#! /home/ncl/mmme1/nmansys/bin/wish #the above line is required to make this file executable #Difine title and matrix size wm title . "Entry Matrix using grid command" set rows 4 set columns 5 #Using loop to create entry cells and then packing them using grid command for {set i 1} {$i <= $rows} {incr i} { for {set j 1} {$j <= $columns} {incr j} { set m$i$j "label$i$j" entry .e$i$j -width 12 -justify center -textvariable m$i$j grid .e$i$j -row [expr $i-1] -column [expr $j-1] } } button .exit -text Exit -command exit grid .exit -columnspan $columns #Note: the advantage of grid command is to align elements into row and/or column style (P.Pongcharoen 2/2001).