how to insert value into "Entry" widget in tkinter in Python

Viewed 33

I tried to insert looping value into Entry widgets, but failed.. can anyone help me?

my code is simple:

from tkinter import *
import time

root = Tk()
root.title("TEST")
root.geometry("150x150")


def num1():
    for i in range(100):
        num=str(i)
        time.sleep(5)


btn = Button(root,text="click",command=num1)

label1 = Label(root,text = "number")
label1.grid(row=0, column=0,padx=10)

ety1 = Entry(root,width=10)
ety1.insert(num)
ety1.grid(row=1, column=0,ipady=1)

root.mainloop()

enter image description here

0 Answers
Related