Nov-10-2017, 07:30 PM
Maybe this helps:
from tkinter import * import random import time class Val: def __init__(self): pass def callback(self): E1.delete(0, END) E1.insert(0, random.randint(0,999)) root=Tk() obj=Val() L1 = Label(root,text="Number") E1 = Entry(root) B1 = Button(root,text="Click",command=obj.callback) L1.grid(row=1,column=1) E1.grid(row=1,column=2) B1.grid(row=1,column=3) root.mainloop()