def onselect(evt):
    w = evt.widget
index = int(w.curselection()[0])
value = w.get(index)
print('You selected item %d: "%s"' % (index, value))
Getting a callback when a Tkinter Listbox selection is changed?