Tkinter listbox - how to swap two items?
Fredrik Lundh
fredrik at pythonware.com
Fri Apr 6 12:26:21 EDT 2001
Simon wrote:
> Obviously I could get the current values, delete the items, and reinsert the
> values at the right indices, but this seems like a bit of a painful
> procedure. The *must* be a more elegant way of doing than that.
how about "get the current value of one item, delete it, and
reinsert it at the right index".
item = list.get(index)
list.delete(index)
list.insert(index+1, item)
Cheers /F
More information about the Python-list
mailing list