Entry
How can I change the text on a label? When I use the variabletext=whatever thing, the label wont show up.
Jul 22nd, 2000 20:22
unknown unknown, richard_chamberlain, Charles G Waldman
from Tkinter import *
root=Tk()
myString=StringVar()
Label(root,textvariable=myString).pack()
myString.set("Well, eh, how about a little red Leicester.")
def changeLabel():
myString.set("I'm, a-fraid we're fresh out of red Leicester, sir. ")
Button(root,text='Click Me',command=changeLabel).pack()
root.mainloop()
I presume where you're going wrong is you are not creating an instance
of StringVar and setting (or getting) the variable through that.
----
See http://www.secretlabs.com/library/tkinter/introduction/index.htm
for lots of useful tkinter information.