Creating a pull-down list with Tkinter

Randall Hopper aa8vb at vislab.epa.gov
Mon May 3 07:39:22 EDT 1999


Ben Gertzfield:
 |After reading through the meagre documentation available for Tkinter,
 |I've stumped myself. Is there any module available that will give
 |me a pull-down list, similar to what appears in tkFileDialog, or
 |any of the zillions of pull-down lists you see on web pages?
 |
 |I'm trying to make a graphical front-end to my ID3 MP3 info tag
 |manipulator Python class, but Listbox is inappropriate when there
 |are ~150 selections possible for one of the fields (the genre
 |of the song) and I need to let the user select from one of them.
 |
 |How can I create a pull-down list with Tkinter?

Here are some simple and more complex ones:

     http://www.pythonware.com/people/fredrik/fyi/fyi34.htm
     http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=451425547
     http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=368413557

If you need to know when a variable in the menu is selected, you'll have to
drop down and use a Tk trace variable, or create your own enhanced
OptionMenu with a command callback.  This shows how:

     http://www.dejanews.com/[ST_rn=ps]/getdoc.xp?AN=462053022  

Note also that Pmw (http://www.dscpl.com.au/pmw/) has a wrapper around the
OptionMenu and offers a ComboBox as well.

Randall







More information about the Python-list mailing list