From: Stephen Hansen on
On 6/14/10 7:22 PM, rantingrick wrote:
> On Jun 14, 6:27 pm, Stephen Hansen <me+list/pyt...(a)ixokai.io> wrote:
>
>> From a functionality perspective, "pack" and "grid" are both distinctly
>> less capable then wx sizers.
>
> Are you just flapping your gums or can you prove it Stephen? I will
> accept any "Pepsi Challenge" you can muster in Wx code and echo that
> same capability using Tkinter[1] in what will be no less than elegant
> simplicity. So bring it on baby!

But, as to capabilities-- the ones I use not infrequently:

- Shaped expansion: the control maintains its aspect ratio.
- Fitting: The parent widget is resized so that it is the right size
to contain all of its children widgets at their 'best' size (which is
configured per-widget, and not per-column; min sizes on a column is
insufficient). I absolutely adore this feature.
- Alignment. If a widget is allocated 100x100 of space (due to
proportion rules), but not set to expand, control over if it should
center directly, or be aligned top-center or left-middle.
- Spacers. As in a virtual 'widget' which takes up space but doesn't
really exist. Yeah, you can just put some empty looking widget in there,
but that's a hack. Still, this is only a nitpick.

I'm not interested in dueling code, but capabilities.

--

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

From: AD. on
On Jun 15, 1:58 pm, Stephen Hansen <me+list/pyt...(a)ixokai.io> wrote:
> Very nice. And interesting. "position: absolute" there is a mystery to
> me and seems to be key, I'm not sure entirely what it is doing to the
> layout manager in that scenario, but it seems to do the trick.

The Cliff Notes:

position: absolute allows different combos/subsets of
left,right,top,bottom,width,height to define where each edge is in
relation to the edges of its closest parent that has also been
positioned that way or the browser window if there is none. But it
does take that element out of the normal flow (like a float does),
which means all the statically positioned stuff won't interact with it
at all - that can be enough to negate the usefulness of it all.

position: relative is similar, but the edge offsets apply to where the
element would normally have sat rather than the edges of an explicitly
positioned parent element.

>
> Much, much, much Googling led me to try many things to get it just
> right, and all bemoaned the lack of a solid way to vertically center:
> all the while using essentially similar methods to horizontally center.

I'd recommend the book "Pro CSS and HTML Design Patterns" from Apress
for anyone who wants to get a more formal understanding of these
different models etc.

--
Cheers
Anton
From: rantingrick on
On Jun 14, 9:41 pm, Stephen Hansen <me+list/pyt...(a)ixokai.io> wrote:

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

Maybe you should become more aware of a subject before you start
running your mouth about it, eh?

> 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.

Please at least try to make it a bit harder next time, really!

import Tkinter as tk
app = tk.Tk()
app.columnconfigure(1, weight=1)
app.rowconfigure(3, weight=1)
tk.Button(app, text='C', width=20).grid(row=0, column=0,
sticky='nswe')
tk.Button(app, text='D', width=20).grid(row=1, column=0,
sticky='nswe')
tk.Button(app, text='E', width=20).grid(row=2, column=0,
sticky='nswe')
tk.Button(app, text='F', width=20).grid(row=3, column=0, rowspan=2,
sticky='nswe')
tk.Button(app, text='G').grid(row=0, column=1, rowspan=2,
sticky='nswe')
tk.Button(app, text='H').grid(row=2, column=1, rowspan=2,
sticky='nswe')
app.mainloop()

....but i won't hold my breath awaiting for your "spectacular" Wx code
because i know it was just vaporware from gum_flap[0] on.
From: Stephen Hansen on
On 6/14/10 8:04 PM, AD. wrote:
>> Much, much, much Googling led me to try many things to get it just
>> right, and all bemoaned the lack of a solid way to vertically center:
>> all the while using essentially similar methods to horizontally center.
>
> I'd recommend the book "Pro CSS and HTML Design Patterns" from Apress
> for anyone who wants to get a more formal understanding of these
> different models etc.

Favorite'd on Safari, thanks for the tip.

--

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

P.S. Once upon a time, I'd have Amazon'd the book and skimmed it and
then lost it, and bought it again. I love Safari.

From: Stephen Hansen on
On 6/14/10 9:08 PM, Stephen Hansen wrote:
> The code is at: http://ixokai.io/get/layout-wx.py_

If you've already downloaded this, you have to do so again; I uploaded
the wrong one on accident.

--

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