"Wayne" <sri...@gmail.com> wrote
Am I missing something essential here? Or is this a bug that nobody has encountered yet?

Its not a bug its the way GUIs and event driven programs work.

You need to buuld the time delay as an event so the after() approach is nearly right. But you need the first event to make it say Foo then the after event to change it to Bar. You can use a single event handler with a parameter then use a lambda to pass the value in. Something like:

import Tkinter as tk

def funky(value=None):
 if value:
    lbl.config(text=value)
else: lbl['text'] = 'Foo'
    lbl.after(3000, lambda : funky('Bar') )
root = tk.Tk()
lbl = tk.Label(text = "Click the button to see weirdness")
btn = tk.Button(text='Click me', command=funky)
lbl.pack()
btn.pack()
root.mainloop()


Otherwise the GUI doesn;t get redrawn until after the handler exits which means both updates get done at the same time.

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to