A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/083570.html below:

Tkinter listbox - how to swap two items?

Tkinter listbox - how to swap two items? 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4