How do I get the contents of a Tk listbox without selecting each item?
How do I get the contents of a Tk listbox without selecting each item? I have a Tk listbox widget (chosenItems) that gets populated with selected items from another listbox (possibleItems). When a user has chosen all the items they want to manipulate or change, I have a button (Apply) that applies a set of transformations to the list of "chosenItems". To make this work, I need to collect all the entries of the Tk listbox. How do I do that and generate a list for those items? 2 Answers 2 Off the top of my head, not tested: you can specify a -listvariable , which will hold all items in the list, or use the get subcommand, e.g. $myListbox get 0 end . -listvariable get $myListbox get 0 end The Tk listbox supports a get command, so something like: get set lbentries [.l get 0 end] should give you a list of all the entries in the list box (where .l is the listbox widget command). .l Alternatel...
