I am new to Tkinter and I have this problem:
I want to update my ListBox
with new values in a loop so the values are added to it during the loop and not only at the end.
Here is an example code of my problem:
import time
import tkinter as tk
class mainApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
listbox = tk.Listbox(self)
button3 = tk.Button(self, text="addValues",
command=lambda : self.addValues(listbox))
button3.pack()
def addValues(self,listbox):
for i in range(10):
time.sleep(1)
listbox.insert(tk.END, str(i))
listbox.pack()
app = mainApp("test")
app.mainloop()
Here I want the Frame
to update each time a value is added to the ListBox
.