tkinter question

linuxnooby at yahoo.com.au linuxnooby at yahoo.com.au
Thu Mar 30 18:11:19 EST 2006


>If you just create
>a Toplevel and populate it with widgets, it will just display once the
>control is returned to the Tkinter mainloop and no user input will be
>needed.

Thanks for explaining that. I borrowed the "after" method that you used
in your first reply. It seems to do what I want (except for
root.destroy) Though any suggestions on a more elegant solution
welcome.

cheers David


from Tkinter import *

def message1():
    top1 = Tk()
    F1 = Frame(top1)
    F1.pack()
    Hello1 = Label(F1, text="step 2 you will be logged off in 5
seconds")
    Hello1.pack()
    top1.after(3000, message2)

def message2():
    top2 = Tk()
    F2 = Frame(top2)
    F2.pack()
    Hello2 = Label(F2, text="step 3 you will be logged off in 2
seconds")
    Hello2.pack()
    top2.after(2000, goodbye)

def goodbye():
    print "step 4 you are logged out"
    root.destroy

root = Tk()
root.withdraw()
print "step 1 login window withdrawn"

message1()
  
root.mainloop()




More information about the Python-list mailing list