filling a frame with a widget

jmdeschamps at gmail.com jmdeschamps at gmail.com
Wed Oct 4 21:12:54 EDT 2006


Fredrik Lundh wrote:
> Paolo Pantaleo wrote:
>
> >I have this code
> >
> > from Tkinter import *
> >
> > root=Tk()
> > Button(root).pack(fill=BOTH)
> > root.mainloop()
> >
> > I would expect the button filling all the client draw area of the
> > Frame, but when I resize the root window the button becomes wider, but
> > not higher ( I get some empty space under the button).
>
> pack(fill=BOTH, expand=1) should do the trick.
>
> the pack geometry manager works by slicing off vertical or horizontal areas from
> the parent, one area per widget.  the "fill" option controls how to place the widget
> inside that area, the "expand" option controls how to handle any extra space left
> in the parent.  if "expand" isn't set for any child widget, the extra space is left un-
> used.
>
> </F>
I'm not the OP, and I even replied about expand but *now* I know how it
works... Thanks, Fredrik!

jean-marc




More information about the Python-list mailing list