Posted to tcl by fvogel at Mon Aug 27 19:40:28 GMT 2007view pretty
set height 400 set width 600 set borderwidth 2 set hscroll .hscroll set vscroll .vscroll set canvas .c scrollbar $hscroll -orient horiz -command "$canvas xview" scrollbar $vscroll -command "$canvas yview" canvas $canvas -relief sunken -borderwidth $borderwidth \ -width $width -height $height \ -xscrollcommand "$hscroll set" \ -yscrollcommand "$vscroll set" # Ensure that window resizings retain scroll bars. pack $hscroll -side bottom -fill x pack $vscroll -side right -fill y pack $canvas -side right -fill both -expand 1 # Put something visible on the canvas # so we have a sense of what we're seeing. $canvas create line 0 0 $width $height $canvas create line 0 $height $width 0 frame $canvas.f $canvas conf -bg red $canvas.f conf -bg green for {set ID 0} {$ID < 10} {incr ID} { label $canvas.f.lab1$ID -relief groove -takefocus 0 \ -text hello \ -width 24 label $canvas.f.lab2$ID -relief groove -takefocus 0 \ -text world \ -width 5 entry $canvas.f.expression$ID \ -textvariable expression \ -width 30 grid $canvas.f.lab1$ID $canvas.f.lab2$ID $canvas.f.expression$ID -sticky ew } $canvas create window 0 0 -window $canvas.f -anchor nw update $canvas configure -scrollregion [$canvas bbox all]