Tkinter dosent like while loops, this is because a while loop dosent return to the mainloop till its finished and therefore you application isnt working during this time.
Tkinter provides for this the .after(*ms,*func)
method and is used below.
Also for changing the text of a tk.Label
you can go for several ways. I think the best way is to use the inherated option textvariable.
The textvariable needs to be a tk.*Variable
and configures the tk.Label
as soon as the var is set.
Check out the working example below:
import tkinter as tk
x = 0
def change_text():
global x
var.set(x)
x +=1
root.after(100,change_text)#instead of a while loop that block the mainloop
root = tk.Tk()
var = tk.StringVar()
lab = tk.Label(root, textvariable=var)
lab.pack()
change_text()
root.mainloop()