from tkinter import *
import random
import time
class val:
def __init__(self):
self.values=
self.index=0
def assign(self):
self.values.append(random.randint(0,9))
def callback(self):
v.set(self.values[self.index])
time.sleep(0.5)
self.index+=1
root=Tk()
v=StringVar()
L1=Label(root,text="Number").grid(row=1,column=1)
E1=Entry(root,textvariable=v,bd=5).grid(row=1,column=2)
obj=val()
root.mainloop()
This is my code above. I am using Python 3.6 version. I want to make a entry widget which should set a value randomly by getting data from random variable. But I am not getting any value in the entry widget while i run this program. please give me solution
import random
import time
class val:
def __init__(self):
self.values=
self.index=0
def assign(self):
self.values.append(random.randint(0,9))
def callback(self):
v.set(self.values[self.index])
time.sleep(0.5)
self.index+=1
root=Tk()
v=StringVar()
L1=Label(root,text="Number").grid(row=1,column=1)
E1=Entry(root,textvariable=v,bd=5).grid(row=1,column=2)
obj=val()
root.mainloop()
This is my code above. I am using Python 3.6 version. I want to make a entry widget which should set a value randomly by getting data from random variable. But I am not getting any value in the entry widget while i run this program. please give me solution