I am trying to update my label in Tkinter with the value of "x" for every time that "x" changes value. Almost like a live counter. This is a simplified loop because I am working on Pycharm. Eventually I would like to modify this code so that the label is updated with the values from a temperature sensor connected to my Raspberry Pi. Please can some assistance be provided on this topic, Thanks :)
from Tkinter import *
import tkFont
import time
# Window
root = Tk()
root.geometry("700x600+550+100")
# Font
font = tkFont.Font(family = 'Halvetica', size = 36, weight = 'bold')
x = 0
def do():
list = [1, 2, 3, 4]
for x in list:
temp = Label(root, text=x, fg="black", heigh=2, width=15, font=font)
temp.pack()
time.sleep(2)
#temp["text"] = x
do()
root.mainloop()
I expected the program to print 1, then replace 1 with 2 and so forth. I do not want 1,2,3,4 to be presented all together.
When I execute the code it presents me with the numbers 1 to 4 but it did not update it live and they are below each other which is not that I want