Russell E. Owen wrote: > In article <[EMAIL PROTECTED]>, > Alexander Belchenko <[EMAIL PROTECTED]> 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) >
pack_forget does not erm remove either ;) from Tkinter import * root = Tk() root.title("Pack is BEST!!!") l = Label(root, text="Pack is simply the best") l.pack() def forget(): l.pack_forget() def remember(): l.pack() b = Button(root, text="Forget about it", command=forget) b.pack() b = Button(root, text="Wait, I still need you", command=remember) b.pack() root.mainloop() BUT... the remember function packs the label widget in it's new packing order, so it is packed after the two buttons, as far as I know the only way to 'remember' its pack position is to put it inside a Frame widget (and leave the Frame where it stands) - at least thats how I do it To the OP I guess you've seen how easy this is with Tk(inter) :) Cheers, Martin. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss