[Tutor] moving from pack to grid in tkinter

Tony Cappellini cappy2112 at gmail.com
Mon Nov 27 04:41:54 CET 2006


I've got a main window which is 640 * 400.
      self.root.geometry("600x400")

 self.label.pack(side=BOTTOM, fill=X)
This line would put the label at the bottom of the window, and extend to
both left and right edges of the window.

I want to change to grid geometry because I have several more widgets to put
in the main window.
self.label.grid(row=5, column=2, column=0)

This put the label at row 5, in the center of the window, but the label
didn't extend to the window edges.

After reading this http://effbot.org/tkinterbook/grid.htm

I tried playing around with other options, but can't get the label to move
any lower in the main window

self.label.grid(row=10, column=2, column=0)  didn't move the label any lower
than row 5

My main window isn't constructed using pack(), so I'm not mixing grid and
pack in this program.
Although, the main window isn't calling grid explicitly either- that's a bit
confusing, because I thought all widgets had to call grid or pack to be
displayed...

What args do I need to move the label to the bottom of the window, and
centered so it extends to both left and right edges?
I don't like to hard-code a row number, I'd rather make the label
dynamically be assigned to the bootm ros of the window, in case the window
grows or shrinks.


thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061126/865c8f41/attachment.html 


More information about the Tutor mailing list