Tkinter: using a Listbox

Ebba Cecilia Ovesdotter Alm ebbaalm at
Fri Jan 7 22:00:54 CET 2005


I'm learning how to use the Tkinter module. I would like to
use an element similar to a drop-down form,
where the user can select one option out of many. I thought
that a Listbox item could do just this. The following extract
from my code (with the listbox part basically mirroring,
does, however, not create a visable Listbox.  Am I
interpreting the Listbox incorrectly? Ideas or suggestions are

#Frame & label for the listbox
self.selectFrame = Frame(self.root)
self.selectFrame.pack(side=TOP, fill=X, padx=10)
Label(self.selectFrame, text='Primary choice').pack(side=LEFT)
self.listbox = Listbox(self.selectFrame)
self.listbox.insert(END, "a list entry")
for item in ["A","B","C"]:
      self.listbox.insert(END, item)


More information about the Python-list mailing list