Aug-09-2021, 03:57 PM
Hi, I'm new to python and Tkinter (as in two days in!), so appreciate this may be a pretty obvious mistake I'm making. Why is it that if I have a loop(s) in my code that the Tk window doesn't display until the loop(s) has gone through all it's iterations. What I want is for the window to display at the start so that I can then view the result of each iteration in the window. Here's a small sample program to show what I mean. If you run it yourself you'll see the lag before the window opens.
from tkinter import *
root = Tk()
for column in range (0, 50):
for row in range (0, 40):
#calculate next number from row and column
number = row+(column*40)
#create label
myLabel = Label(root, text=str(number))
#display label
myLabel.grid(row=row, column=column)
root.mainloop()
