Entry
How can I replace the contents of a listbox with a new list of items?
Aug 15th, 2000 04:03
unknown unknown, Matthew Dixon Cowles
All you have to do is delete the old items and add some new ones:
self.lb.delete(0, END) # clear
for item in myList:
self.lb.insert(END, item)
I swiped that code pretty well directly from Fredrik Lundh's excellent
introduction to Tkinter, which is at:
http://www.pythonware.com/library/tkinter/introduction/index.htm
If you haven't had a look at it, you may want to.
You might also want to have a look at Greg MacFarlaine's cool Pmw
(Python megawidgets):
http://www.dscpl.com.au/pmw/
His ScrolledListBox widget will save you a step here since it has a
setlist() method.