[Tkinter-discuss] Removing widgets
Roland Hedberg
roland at catalogix.se
Mon May 24 05:09:41 EDT 2004
Hi!
I'm a complete newbie on tkinter so I can only
hope that this is the right forum for this question.
Anyway, I have the following problem:
In one part of my main window ( the local definition part), I want to
insert labels and entry window pairs. Which labels are printed are
dependent on which entry that has been choosen in a listbox in another
part of the main window.
The pairs are added to a frame that are packed into the main frame.
The snippet that does the pairs looks like this:
i = 0
for lab in labels:
l = Label(local, text=lab+":")
l.grid(row=i)
self.lab.append(l)
e = Entry(local)
e.grid(row=i, column=1)
self.ent.append(e)
i += 1
If another entry from the list is choosen then the labels and
accompaning entry windows should change. Noticable is that the number of
label/entry pairs differs between different choices in the listbox and
that the length of the labels also varies.
So what I want to do is to clear the local definition frame of the main
window when a new listentry are choosen and then write the new pairs.
Preferrably without having the frame size change, but that is secondary
at present.
My problem is that I am unable to 'clear' the frame, I can't get rid of
the labels I once have written (or the entries for that matter). I can
overwrite them but that only 'works' if all the labels are of the same
length which they aren't.
I've tried to use destroy and forget but to no avail.
Anyone who knows how to do this ?
-- Roland
More information about the Tkinter-discuss
mailing list