Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python tkinter listbox detect selection change

def onselect(evt):
    # Note here that Tkinter passes an event object to onselect()
    w = evt.widget
    index = int(w.curselection()[0])
    value = w.get(index)
    print('You selected item %d: "%s"' % (index, value))

lb = Listbox(frame, name='lb')
lb.bind('<<ListboxSelect>>', onselect)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #tkinter #listbox #detect #selection #change
ADD COMMENT
Topic
Name
4+9 =