Python Forum
[split] New at Python programming
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] New at Python programming
#1
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
Reply


Messages In This Thread
[split] New at Python programming - by Akash - Nov-06-2017, 05:23 PM
RE: [split] New at Python programming - by heiner55 - Nov-10-2017, 07:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGUI] Start learning GUI Programming python sumandas89 1 1,984 Jan-18-2019, 02:11 PM
Last Post: Larz60+
  New at Python programming rsmldmv 1 1,934 Nov-03-2017, 02:48 AM
Last Post: Larz60+
  [PyGUI] Opinions on Python GUI programming cdn 2 3,471 Aug-26-2017, 11:56 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020