I read in a tutorial that I can separate the data from the tkinter.Listbox into my own list. I did this in the example here.
But how can I manipulate the order of the Listbox-entries based on my own variablelist?
#!/usr/bin/env python3
from tkinter import *
root = Tk()
mylist = ['one', 'two', 'three']
var = StringVar(value=mylist)
box = Listbox(master=root, listvariable=var)
box.pack(fill=BOTH, expand=True)
# this need to affect the list
mylist.append('four')
mylist.remove('two')
mylist.insert(3, mylist.pop(1))
root.mainloop()
The Listbox (in the GUI) here is not affected.
As I understand there is a way that Listbox refresh absolut automaticly its content when I modify the data-list. So I don't have to touch Listbox. I only need to touch the data in the list().
Is there a way?
boxand add new items frommylist. Listbox on effbot.org