Katie,
See
http://www.pythonware.com/library/tk...3-patterns.htm
"You can also use a listbox to represent arbitrary Python objects. In
the next example, we assume that the input data is represented as a list
of tuples, where the first item in each tuple is the string to display
in the list. For example, you could display a dictionary by using the
items method to get such a list.
self.lb.delete(0, END) # clear
for key, value in data:
self.lb.insert(END, key)
self.data = data
When querying the list, simply fetch the items indexed by the selection
list:
items = self.lb.curselection()
try:
items = map(string.atoi, items)
except ValueError: pass
items = map(lambda i,d=self.data: d[i], items)"
Katie Beach wrote:
I have a listbox in which I would like to be able to display a value of
a hash, but when the user selects an element in the list, I need to be
able to use the KEY associated with the value chosen for editing... I
don't see an easy way to do this except to create a lookup array that
contains an index and a KEY - the index will then be associated with the
VALUE in listbox... this seems like a pretty messy way to do this, so
I'd like to avoid it if I could. Has anyone else needed something
similar, and if so, what was their solution to the problem!!
Many Thanks,
Katie
------------------------------------------------------------------------
Click, drag and drop. My MSN is the simple way to design your homepage.
<http://g.msn.com/8HMAENUS/2734??PS=>