Posted to tcl by dgp at Wed May 25 16:38:44 GMT 2011view pretty

set linecount 5000

. configure -width 600 -height 300
pack propagate . 0

set msg [canvas .msg]

set yscroll [scrollbar .yscroll -orient vertical \
                -command [list $msg yview]]

pack $msg -side left -fill both -expand 1
pack $yscroll -side left -fill y

for {set i 0} {$i<$linecount} {incr i} {
   append text "$i\n"
}
append text "The end"

$msg create text 0 0 -anchor nw -text $text

foreach {xmin ymin xmax ymax} [$msg bbox all] break
$msg configure -scrollregion [list $xmin $ymin $xmax $ymax]
$msg configure -yscrollcommand [list $yscroll set] \
                -scrollregion [list $xmin $ymin $xmax $ymax]