I have a Tkinter app where I have two Listbox widgets in different frames
with both frames in a parent frame.  I want to restrict each Listbox to one
selection, but be able to make a selection in each box simultaneously.  But
I am only able to select one entry in the two boxes, i.e., a selection in
one box forces the other box to lose its selection.  At least as far as the
highlighting is concerned.  Anyone have any advice?

 

Ralph Tindell

 

Here is the relevant code segment:

 

        twoBox = Frame(frame,bd=2,relief = RAISED)

 

        iframe3 = Frame(twoBox, bd=2, relief=GROOVE)

        listbox1 = Listbox(iframe3, width=30, height=10)

        for line in ['Student One','Student Two','Student Three','Student
Four']:

            listbox1.insert(END, line)

        listbox1.pack(side=LEFT,fill=X, padx=5)

        sb1 = Scrollbar(iframe3, orient=VERTICAL, command=listbox1.yview)

        sb1.pack(side=LEFT, fill=Y)

        listbox1.configure(yscrollcommand=sb1.set)

        iframe3.pack(side=LEFT)

 

        iframe2 = Frame(twoBox, bd=2,relief=GROOVE)

        listbox2 = Listbox(iframe2, width=30, height=10)

        for line in ['file1','file2','file3','file4']:

            listbox2.insert(END, line)

        listbox2.pack(side=LEFT,fill=X, padx=5)

        sb2 = Scrollbar(iframe2, orient=VERTICAL, command=listbox2.yview)

        sb2.pack(side=LEFT, fill=Y)

        listbox2.configure(yscrollcommand=sb2.set)

        iframe2.pack(side=LEFT)

 

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to