Tkinter: Selecting one item in each of two listboxes

Jeffrey Barish jeffbarish at starband.net
Mon Apr 19 18:16:53 EDT 2004


I have an application that produces two listboxes.  I would like to be
able to select one of the items in the first listbox and one of the
items in the second listbox.  However, when I make my selection in the
second listbox, the selected item in the first listbox gets deselected. 
Is there a way to do this?  I tried setting selectmode to MULTIPLE, but
that option only allows me to select multiple items in one of the
listboxes (both of which get deselected when I make a selection in the
second listbox).

I create the listboxes as follows:

listbox1_frame = Frame(root)
listbox1_frame.pack()
listbox1 = Listbox(listbox1_frame, width = 40, height = 12)
listbox1.pack()

listbox2_frame = Frame(root)
listbox2_frame.pack()
listbox2 = Listbox(listbox2_frame, width = 40, height = 8)
listbox2.pack()

-- 
Jeffrey Barish





More information about the Python-list mailing list