scrollbar
Tcl/Tk
#!/usr/local/bin/wish4.2
listbox .list -yscrollcommand ".scroll set" \
-width 20 -height 16 -setgrid 1
scrollbar .scroll -command ".list yview"
pack .list .scroll -side left -fill y -expand 1
foreach f [glob *] {
.list insert end $f
}
ruby/Tk
#!/usr/local/bin/ruby
require "tk"
list = scroll = nil
list = TkListbox.new {
yscroll proc{|idx|
scroll.set *idx
}
width 20
height 16
setgrid 1
pack('side' => 'left', 'fill' => 'y', 'expand' => 1)
}
scroll = TkScrollbar.new {
command proc{|idx|
list.yview *idx
}
pack('side' => 'left', 'fill' => 'y', 'expand' => 1)
}
for f in Dir.glob("*")
list.insert 'end', f
end
Tk.mainloop