GUIs - A Modest Proposal

Stephen Hansen me+list/python at ixokai.io
Mon Jun 14 22:41:36 EDT 2010


On 6/14/10 7:05 PM, rantingrick wrote:
> """The Place geometry manager is the simplest of the three general
> geometry managers provided in Tkinter. It allows you explicitly set
> the position and size of a window, either in absolute terms, or
> relative to another window."""
> 
>> I've no interest in talking about "place"; absolute positioning is
>> simply pointless to me.
> 
> That argument ceases to be "relevant". See the triple quoted text for
> an explanation as to why it is irrelevant and based on ignorance.

I didn't make an argument, so it can't be relevant or not. It remains
pointless.

>> unless I've been long mistaken in pack not
>> having a proportional option. A combination of "fill/expand" and
>> "anchor" do most of everything else, though, that wx's flags and
>> alignment options.
> 
> <snip code>
> 
>> You can rewrite something very similar in Tkinter, sure. And you'll have
>> shorter names, and maybe you can argue 'pack' is more pythonic then
>> 'SetSizerProps', but debating API pythonicity is just uneventful.
> 
> What is this fascination with "pack" all about Stephan? The "pack"
> geometry manager is the least useful of the three. Grid is your most
> useful "all around" manager for laying out complex widget displays.
> However that fact is not obvious to most Tkinter noobs because they do
> not know about the "rowconfigure" and "columnconfigure" options that
> allow for dynamic resizing of widgets within a container based on a
> weight factor. There are also options for "sticky" behavior. The
> following is my suggestions on when to use and *not* to use grid,
> pack, and/or place.

I wasn't aware of [row|column]configure, no: however, I am dubious of
how it directly applies.

Consider this relatively simple user interface layout:
http://ixokai.io/get/layout-grid.jpg

In this context, we have two principle columns, A and B. A has a set
size, B grows to fill the rest of the dialog.

Inside of A, there are four items in a vertical line. The bottom which
takes up half of the total vertical space (poorly drawn, trust me, F
should be half :)), and the top three share the rest.

Inside of B, G is one third the size of H.

The layout should fully resize itself as the window is resized.

How would you implement that in tkinter? It sounds like you'd have a
grid with a pair of one-column grids, which is slightly bizarre seeming.

> The only people who like Wx geometry managers are the same who have no
> experience with Tkinter's beautiful geometry managers. I encourage you
> to investigate them for yourself. If anyone needs help feel free to
> send me a private email or ask here on c.l.p.

And exactly what's so great about it? All of the things you said it can
do, wx can do easily.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20100614/38bc9c40/attachment-0001.sig>


More information about the Python-list mailing list