Re: How to create a self-destructing Tkinter dialog box?
On Thu, 17 Dec 2009 02:09:03 -0500, Martin P. Hellwig martin.hell...@dcuktec.org wrote: mrstevegross wrote: Ok, I would like to put together a Python/Tkinter dialog box that displays a simple message and self-destructs after N seconds. Is there a simple way to do this? Thanks, --Steve Just, thinking aloud, I probably would do something like registering the [place|grid|pack]_forget() function by using the alarm callback 'after()' function of that frame. Yup, after() is your friend: #--- from Tkinter import * from functools import partial def RemoveWindow(win): win.destroy() # root window root = Tk() Label(root, text=this is the main window).pack() # another top-level window, to be removed in 2 seconds top = Toplevel() Label(top, text=this is the window to be removed).pack() root.after(2000, partial(RemoveWindow, top)) # go root.mainloop() #--- HTH, John -- http://mail.python.org/mailman/listinfo/python-list
How to create a self-destructing Tkinter dialog box?
Ok, I would like to put together a Python/Tkinter dialog box that displays a simple message and self-destructs after N seconds. Is there a simple way to do this? Thanks, --Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: How to create a self-destructing Tkinter dialog box?
mrstevegross wrote: Ok, I would like to put together a Python/Tkinter dialog box that displays a simple message and self-destructs after N seconds. Is there a simple way to do this? Thanks, --Steve Just, thinking aloud, I probably would do something like registering the [place|grid|pack]_forget() function by using the alarm callback 'after()' function of that frame. -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoning to own preference.' -- http://mail.python.org/mailman/listinfo/python-list