[Tkinter-discuss] Adding/removing widgets from a running application?
Russell E. Owen
rowen at cesmail.net
Tue Feb 12 20:40:06 CET 2008
In article <foqjpn$eff$1 at ger.gmane.org>,
Alexander Belchenko <bialix at ukr.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jim Kleckner пиÑеÑ:
> | Any pointers to what it takes to add/remove widgets
> | from a running application?
>
> Something like this maybe?
>
> from Tkinter import *
> root = Tk()
> x = Label(root, text='Hello')
> x.pack()
> Button(root, text='Hide', command=x.pack_forget).pack()
> root.mainloop()
Or if you use the gridder you can remove things temporary and restore
them again easily:
x.grid(row=0....)
x.grid_remove() # to temporarily remove
x.grid() # to restore using the original grid settings
x.grid_forget() # to remove permanently
(remove is not supported by the packer)
-- Russell
More information about the Tkinter-discuss
mailing list