[Tutor] How to set up comboboxes

D-Man dsh8290@rit.edu
Mon, 8 Jan 2001 10:30:30 -0500

My recommendation would be to build a couple of arrays (lists) with
all the data.  Have 1 list with the states, and each state has an
index.  Have a second list that can be indexed by state (umm,
actually, just use a dictionary -- this is python, not C after all).
This dicitionary can hold a list of cities as the value.  Then you can
have a nice little loop to put those cities into the combo-box.


On Mon, Jan 08, 2001 at 02:04:50PM -0600, Fred Schroeder wrote:
| Hi!
| I have a question on setting up comboboxes, or listboxes with Tkinter.
| In my program, I want the user to select one of the fifty states in combo1,
| and based on this, select a city from combo2, armed with this information,
| the program will open an ascii datafile for the location.  There will be
| about 10 cities for each state, is there a better way to specify what should
| show up in combo2 than 50 if statements?  Also, how do I set the comboboxes
| so that the user can not enter information into them.
| Fred
| _______________________________________________
| Tutor maillist  -  Tutor@python.org
| http://www.python.org/mailman/listinfo/tutor