[Tkinter-discuss] Swapping 2 widgets btween 2 cells in a grid-layout

Dave and Kerrie Giesen dkgiesen at frontiernet.net
Wed Feb 3 03:53:29 CET 2010

You should be able to do something like the following:

# initial grid
label1.grid(row=0, column=0)
label2.grid(row=1, column=0)

# remove the labels from the grid so that they forget their original 

# Put the labels back but switched
label2.grid(row=0, column=0)
label1.grid(row=1, column=0)


GKalman wrote:
> I would like to swap the (grid cell) positions of 2 label-widgets (in an
> array of widgets) in response to a mouse-event. (I have no trouble swapping
> variables, but can't do it with widgets). Any suggestions or references
> would be appreciated.

More information about the Tkinter-discuss mailing list