Sean McIlroy wrote:
I've got a bunch of Frames, all packed into the root window with
side=TOP, and in each Frame I've got a Checkbutton packed with
side=LEFT. I expected the Checkbuttons to be flush with the left edge
of the window, but they're not, and it looks a little gross. How do I
get them to align?

The standard behaviour for frames is to adapt to their contents, and packing them with side=TOP without any other option will center them in their container.


So you have a few solutions to your problem:
- use the anchor option when packing the frames; setting anchor=W should do what you want
- use fill=X when packing the frames, as Harold said. This expands the frame to the whole width of its container, so this should align the check-buttons (if it doesn't work, add the option expand=1 to force the frame to be wider than its contents)


A silly question BTW: why do you use frames? If you have only check-buttons in them, you do not need them:

from Tkinter import *
root = Tk()
for i in range(0, 101, 20):
  b = Checkbutton(root, text='Option %s' % i)
  b.pack(side=TOP, anchor=W)
root.mainloop()

HTH
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to