OUTPUT BUFFER:
#!/usr/local/ActiveTcl/bin/wish package require Tktable proc Donne {w r c} { set v [set ::Data($r,$c)] $w tag cell T$v $r,$c return $v } set Cf { {0 white black} {1 white blue} {2 white red} {3 white green} {4 white yellow} {5 white magenta} {6 white forestgreen} {7 white darkgrey} {8 black orange} {9 black white} } for {set r 0} {$r < 20} {incr r} { for {set c 0} {$c < 10} {incr c} { set Data($r,$c) $c } } font create MyFont -family CourierNew -size 10 -weight normal set Dt [string repeat "0123456789\n" 20] text .t -font MyFont \ -bg cyan \ -highlightthickness 0 \ -relief flat \ -bd 0 \ -width 10 \ -height 20 table .k -font MyFont \ -bd [list 0 0 0 0] \ -drawmode compatible \ -width 10 \ -height 20 \ -rows 20 \ -cols 10 \ -colwidth 1 \ -bg yellow \ -justify left \ -anchor w \ -state disabled \ -usecommand 1 \ -command [list Donne %W %r %c] \ -highlightthickness 0 \ -pady 0 -ipady 0 \ -padx 0 -ipadx 0 \ -relief flat \ -colstretchmode none \ -rowstretchmode none .t insert end $Dt grid .k -row 0 -column 0 -sticky news grid .t -row 0 -column 1 -sticky news foreach e $Cf { lassign $e n f b .k tag configure T$n -foreground $f -background $b }