[Tkinter-discuss] moving from pack to grid
sxn02 at yahoo.com
Mon Nov 27 17:05:10 CET 2006
> self.label.grid(row=5, column=2, column=0)
Why do you have "column" twice?
Grid will always compact your GUI: if you grid something on row 3, and rows 0..2 are
empty, everything is pushed up. If you add a widget at row 2, row three goes down one
level to make room for row two. Similarly, for columns to the left.
If you need to have the empty rows/columns shown as empty, grid some placeholders (a
label with an empty text, stuff like that), and destroy them when replacing with the real widgets.
from Tkinter import *
l1=Label(root, text='A label')
l1.grid(row=2) # rows 0 and 1 are empty, so the grid manager will put the label on top
# let's push it down, to the real home row
pl1=Label(root) # first placeholder
pl2.grid(row=1) # second placeholder
# now let's put something on row 0, "real stuff"
About filling a cell in the grid: check the sticky option.
About filling two or more adjacent cells with one widget: check the rowspan and
Hope this help,
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tkinter-discuss