Tkinter problem

Eirik hannibalkannibal at yahoo.no
Sun Jun 22 05:17:30 EDT 2003


Look at this code(I am not sure whether it is correct or not, I am in
Windoze and have no possibility to check):
--CODE BEGIN--

from Tkinter import *



root = Tk()



root.t = StringVar()

root.l1 = Label(root, textvariable = root.t)

root.b1 = Button(root, text = "Button", command = root.t.set("Test-Text"))

root.bE = Button(root, text = "End", command = exit)



root.l1.grid()

root.b1.grid()

root.bE.grid()

root.mainloop()

--CODE END--

The problem with this code is that "l1" gets the text "Test-Text" without my
pushing the button "b1". How come?

How can I make it wait until I press the button before the message in the
label comes?



Inexperienced Tkinter Programmer










More information about the Python-list mailing list