By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

Tkinter: using a Listbox

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> #Listbox
self.listbox = Listbox(self.selectFrame)
self.listbox.insert(END, "a list entry")
for item in ["A","B","C"]:
self.listbox.insert(END, item)


Don't forget to pack the listbox.

You may find this useful...
http://www.ferg.org/thinking_in_tkinter/index.html

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.