468,765 Members | 1,246 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Tkinter: using a Listbox

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
1 2563
> #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.

Similar topics

2 posts views Thread by Nicolas Favre-Félix | last post: by
4 posts views Thread by Patrick L. Nolan | last post: by
2 posts views Thread by Zhang Le | last post: by
2 posts views Thread by Harlin Seritt | last post: by
3 posts views Thread by Harlin Seritt | last post: by
3 posts views Thread by vedran_dekovic | last post: by
3 posts views Thread by Kevin Walzer | last post: by
2 posts views Thread by Ben Collver | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.