I can see where
Bong was going with this example, but it doesn't include quite all the code you need.
As
Bong implies, the listbox
curselection operation returns the index(es) of the listbox item(s) currently selected. But to then retrieve the actual text value of the item, you need to use the index as an argument to the listbox's
get operation. Alternately, if you've associated a "listvariable" with a listbox, then Tk automatically keeps the contents of the listbox and the list stored in the listvariable synchronized -- which means that you could use
lindex to retrieve the values from the associated listvariable rather than using the listbox
get operation.
So,
Bong's code just needs to add the listvariable linkage:
[tt]listbox $w.hval
-listvariable filelst[/tt]
- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting,
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax