Im trying to display user inputs in a lable on a tkinter tab using a function that makes a lable, but instead of it updating ever time I run it, it prints a new lable. How do I stop this? My code looks like this:
import time
from tkinter import *
import tkinter as tk
calNums = []
root = Tk()
def key(event):
if event.keysym == '1':
calNums.append(1)
time.sleep(0.05)
displayScreenProgress()
root.bind_all('<Key>', key)
def displayScreenProgress():
cal_display = StringVar()
label = Label(root, textvariable=cal_display, relief=RAISED)
cal_display.set(calNums)
label.pack()
root.mainloop()
I have nine more of these for the other nine numbers:
if event.keysym == '1':
calNums.append(1)
time.sleep(0.05)