Tkinter: using a Listbox

  • Thread starter Ebba Cecilia Ovesdotter Alm
  • Start date
E

Ebba Cecilia Ovesdotter Alm

Hello,

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
http://effbot.org/books/tkinterbook/listbox.htm),
does, however, not create a visable Listbox. Am I
interpreting the Listbox incorrectly? Ideas or suggestions are
appreciated.

#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)
#Listbox
self.listbox = Listbox(self.selectFrame)
self.listbox.insert(END, "a list entry")
for item in ["A","B","C"]:
self.listbox.insert(END, item)

Thanks,
Cecilia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top