Tkinter: How to remove stacking order of a widget in grid manager
David Allen
s2mdalle at titan.vcu.edu
Tue Feb 6 19:31:43 EST 2001
In article <3A80712D.BAF8FC0D at pacific.net.hk>, "Bernie"
<bernie at pacific.net.hk> wrote:
> Below is the code fragment:
>
> # remove widget from Grid Display manager
> for w in widget_list
> w.grid_remove()
>
> # re-ordering the widget
> widget_list.sort( mySort) # mySort() is not listed
>
> # display widgets in new orders
> col = range(5) row = 0 for w in widget_list:
> for i in col:
> w.grid( column = i, row = row)
> row = row + 1
I think what the problem is that it has to be done
in the parent, not the child. So if 5 things are
grid() into a widget called wid, then
wid.grid_forget() will ungrid all of the items.
By calling grid_forget on the items you want to take
out of the grid, you're unpacking their subitems
but not them.
Example:
f = Frame(parent)
b = Button(f, text="Foobar")
b.grid(row=0, col=0)
if you then want to get rid of b, you do
f.grid_forget()
NOT
b.grid_forget()
Hope this helps.
--
David Allen
http://opop.nols.com/
----------------------------------------
"I must say that I find television very educational. The minute
somebody turns it on, I go to the library and read a book."
--Groucho Marx
More information about the Python-list
mailing list