GUIs - A Modest Proposal

rantingrick rantingrick at gmail.com
Mon Jun 14 23:31:03 EDT 2010


On Jun 14, 9:41 pm, Stephen Hansen <me+list/pyt... at 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.



More information about the Python-list mailing list