A minimal table example

I found this in Graffiti (contributed by Kroc) and found it a great demonstration of the ease of setting up a table using Tcl.

  package require Tk
  proc selrow { W } {
    foreach w [winfo children [winfo parent $W]] {
      if {[lindex [grid info $W] 5] == [lindex [grid info $w] 5]} {
        $w configure -bg red ; # replace by your code here ...
      } else {
        $w configure -bg white ; # ... or here
      }
    }
  }

  for {set r 0} {$r < 10} {incr r} {
    for {set c 0} {$c < 10} {incr c} {
      grid [label .${r}$c -text "row $r\ncol $c" -bg white -relief ridge] -row $r -column $c
      bind .${r}$c <1> {+ selrow %W}
    }
  }

It sets up a table of labels and adds a row selection binding. Great starting point if Tktable is overkill for your needs.

See also Simple TkTable for a slightly more powerful version of the same idea.