I'm trying to take all the items from a listbox and move them to another listbox in another frame. I tried this but listbox2 wont update when listbox1 is changed.
for i in range(listbox1.size()):
listbox2.insert(i, (listbox2.get(i)))
CodePudding user response:
If you just want to synchronize the content of the two listboxes, set the listvariable
option of the two listboxes to the same StringVar()
:
import tkinter as tk
...
var1 = tk.StringVar()
listbox1 = tk.Listbox(..., listvariable=var1)
...
listbox2 = tk.Listbox(..., listvariable=var1)
...