473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2756
> #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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nicolas Favre-Félix | last post by:
Hello, I have a little problem using Tkinter: I'd like to make a interface with 3 labels on the left, facing with 3 Entry on the right, a button below Entrys, and a Listbox under all. I could...
4
by: Patrick L. Nolan | last post by:
Our Tkinter application has a big ScrolledText widget which is a log of everything that happens. In order to prevent people from making changes, we have it in DISABLED mode except when the...
2
by: Zhang Le | last post by:
Hello, Is there a quick way to replace the content of a single item in tkinter's listbox? Currently my solution is to first delete the item, then insert a new item at the same position. I think...
2
by: Harlin Seritt | last post by:
Whenever I set up something similar: vals = for v in vals: listbox.inset(END, v) I notice that when this listbox is displayed, there is never a default value. How can I make sure that one...
3
by: Harlin Seritt | last post by:
I've created a ghetto-ized ComboBox that should work nicely for Tkinter (unfortunately no dropdown capabilities yet). I've found why it's such a pain in the @ss to create one. You have to...
3
by: vedran_dekovic | last post by:
Hi, I need help about Tkinter listbox widget.I want,when somebody click on any item(file) in Listbox,then in new Label widget text must be selected item from server. my program (wrong...
32
by: Kevin Walzer | last post by:
I'm a Tcl/Tk developer who has been working, slowly, at learning Python, in part because Python has better support for certain kinds of applications that I want to develop than Tcl/Tk does....
3
by: Kevin Walzer | last post by:
I'm trying to set the active item in a Tkinter listbox to my application's currently-defined default font. Here's how I get the fonts loaded into the listbox: ...
2
by: Ben Collver | last post by:
I am using Darwin 10.4.9, tcl 8.4.7, tk 8.4, and python 2.3.5. I have also tried Python 2.5 on Darwin, Debian, and Fedora Core 6. I am working on a GUI front-end to a Python program of mine. It...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.