[Tutor] Simple Tkinter question (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Oct 7 09:26:29 CEST 2005



---------- Forwarded message ----------
Date: Thu, 6 Oct 2005 23:55:26 -0700 (PDT)
From: Mike Cheponis <mac at Wireless.Com>
To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] Simple Tkinter question

Danny, I got it:


from Tkinter import *
from time import *

def my_update():
   for i in range(3):
     tv.set("Now it's %d"%i)
     root.update()
     sleep(1)

root=Tk()
tv=StringVar()
Entry(textvariable=tv).pack()
tv.set("Initial Value of StringVar")
Button(text="Update", command=my_update).pack()
root.mainloop()



Trick is call to update() - which I found by looking at a few pages before the one your URL pointed me to, so THANKS!!! again.

Detail is here:   http://www.pythonware.com/library/tkinter/introduction/x9374-event-processing.htm

-Mike



More information about the Tutor mailing list