tkinter question
Kevin Walzer
kw at codebykevin.com
Fri Oct 5 09:17:24 EDT 2007
Eric Brunel wrote:
> On Fri, 05 Oct 2007 14:10:57 +0200, Kevin Walzer <kw at codebykevin.com>
> wrote:
>> "expand = 1" == "expand=TRUE"--that means the widget resizes itself
>> when the window is re-sized.
>
> That's the theory... But what does fill=BOTH means then? And why does
> expand=1 (or TRUE, or True) is only needed in some cases and not others?
> And I'm quite sure that sometimes, I use expand=1 and it does exactly
> what I don't want, and removing it gives the behaviour I want. I've been
> doing tk/Tkinter stuff for quite a few years now, and I still haven't
> understood exactly when I should use this option... Quite
> counter-intuitive, IMHO.
>
> But then, since I almost never use pack for this kind of layout, I guess
> it's not really important...
"Fill" refers to the dimension/space that is filled when you expand the
widget (assuming "expand" is set to true). "fill=x" means the widget
will expand horizontally (along the x axis). "fill=y" means that the
widget will expand vertically (along the y axis). "fill=both" means the
widget will expand in both direction.
Frederick Lundh has a good introduction to the packer here:
http://effbot.org/tkinterbook/pack.htm
I find "pack" to be more flexible than "grid," so I prefer it for
complex layouts. "grid" is better for simple layouts.
HTH,
Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
More information about the Python-list
mailing list