value = w.get(index)
print('You selected item %d: "%s"' % (index, value))
lb = Listbox(frame, name='lb')
lb.bind('<<ListboxSelect>>', onselect)
Getting a callback when a Tkinter Listbox selection is changed?