tkinter question

Eric Brunel see.signature at no.spam
Mon Oct 8 04:08:34 EDT 2007


On Sun, 07 Oct 2007 18:09:16 +0200, Kevin Walzer <kw at codebykevin.com>  
wrote:
> Hendrik van Rooyen wrote:
>> "Kevin Walzer" <kw at codebykevin.com> wrote:
>>
>>> I find "pack" to be more flexible than "grid," so I prefer it for  
>>> complex layouts. "grid" is better for simple layouts.
>>  *does a double take*  are you serious? - my experience is that
>> pack is only good for simple single row or single column stuff.

I agree with Hendrik, here...

> Well, I guess it depends on your viewpoint. I find "pack" flexible  
> because it allows me to think in terms of top, bottom, right, and left  
> in terms of arranging UI elements--it's an elegant way to do it in my  
> view. I tend to use "grid" if I have, say, a window with several  
> preference items: a label, an entry field, and a button, all arranged in  
> rows. "grid" is better for stuff like that, I agree.
>
> See http://www.codebykevin.com/blosxom/business/phynchronicity-new.png:  
> this is an application I develop. The layout is all handled by "pack"  
> and paned windows. Where you you use "grid" in a layout like this?

I personally use grid almost everywhere, except for basic rows or columns  
of widgets with no resizing policy. I find pack confusing, for the very  
same reason you find it flexible apparently; for me, this  
top/bottom/left/right stuff is not clear at all, and even after all the  
explanations I read (including yours), I still don't get the resize policy  
with pack. The single 'sticky' option with the row & column weights with  
grid is just clearer for me. And there are layouts that you just can't do  
with pack (canvas or text with vertical and horizontal scrollbars, for  
example...).

But apparently, even this is - again - a matter of taste. So I guess I'll  
have to stop telling everyone that grid is better... ;-)
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list