[Tkinter-discuss] Two Listbox problem

Ralph Tindell rtindell at cse.usf.edu
Tue Sep 30 21:58:25 CEST 2008

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

            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)




        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)




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20080930/cd0d072c/attachment.htm>

More information about the Tkinter-discuss mailing list