Posted to tcl by dkf at Fri Feb 11 10:13:29 GMT 2011view pretty

# Basic scrollable container setup
package require Tk
canvas .c -width 100 -height 100 -yscrollcommand {.s set}
scrollbar .s -orient vertical -command {.c yview}
pack .c .s -fill y -expand 1 -side left -padx 2 -pady 2
set w .c.f
.c create window 0 0 -window [frame $w] -anchor nw -width 100 -height 150
bind $w <Configure> {.c configure -scrollregion [list 0 0 %w %h]}

# Basic content; scrollable windows *must* be children of scroller
label $w.l -text "Just so you\nknow it is\nscrolled" -background yellow
pack $w.l -expand 1 -fill both

# The problem...
.c configure -relief sunken -borderwidth 2
# ...is that now the label can overlap that border!