#!/usr/bin/env wish

proc show_selection {y} {
  puts [.l get [.l nearest $y]]
}
 
listbox .l -height 5
.l insert end 1 2 3 4 5 6 7 8 9 10
.l insert 0 "0"
scrollbar .s -command ".l yview" 
.l configure -yscrollcommand ".s set"
pack .l -side left
pack .s -side right -fill y

bind .l <Button-1> "show_selection %y"

bind . <Key-q> exit

