Tkinter: How to remove stacking order of a widget in grid manager

Fredrik Lundh fredrik at
Wed Feb 7 17:52:23 CET 2001

Bernie wrote:
> I have an application which requires reordering the widgets during
> runtime.  I am using the grid manager and found two functions
> grid_remove() and grid_forget().  I thought grid_remove() should
> does the job, it doesn't, neither do grid_forget().
> How can that be done?

just calling "grid" again (with or without grid_remove
or grid_forget) works fine for me.  try this:

# a simple regridding test

from Tkinter import *

root = Tk()

def flip():
    for i in range(10):
        buttons[i].grid(column=0, row=i)

buttons = []
for i in range(10):
    b = Button(root, text=i, width=20, command=flip)
    b.grid(column=0, row=i)


(just click on any of the buttons to move them around)

Cheers /F

More information about the Python-list mailing list