Tkinter: Making a listbox that can change variables on selection
问题 Now I made a procedure that activates on the click of a button. Now say I have a listbox called: selection = Tkinter.Listbox(b_action) selection.insert(1,"stuff") selection.insert(2,"morestuff") a = 0 How can I make that procedure run, each time I select a different part of the listbox? For example I first click "stuff" and then click "morestuff". Clicking "stuff" sets a to 1 and clicking "morestuff" sets a to 0 again. 回答1: You can create a dictionary mapping the actual listbox values with