Tkinter vs wxPython: your opinions?
Christian Tanzer
tanzer at swing.co.at
Fri Jan 26 02:56:57 EST 2001
rwklee at home.com wrote :
> Thank you all for your thoughtful posts. On reflection, I would say my
> greatest need would be:
>
> - being able to build data entry screens on the fly from a description of
> an object's attributes
>
> I am still very naive about this; but I would have thought the need for
> this feature would crop up frequently. I wonder why it doesn't seem to be
> featured in the popular toolkits. Maybe it is extremely easy for anyone to
> build, in which case would someone care to post a working example. Thanks.
Sorry, I can't easily post working code.
But your problem is easy to solve if you use a good geometry manager,
like Tkinter's pack or grid (grid being my preferred solution).
For Tkinter, it looks like:
body = Frame (...)
entries = []
for entry_desc in «description of an object's attributes» :
label = Label (master = body, text = entry_desc.name, ...)
entry = Entry (master = body, ...)
label.grid (column = 0, row = len (entries), ...)
entry.grid (column = 1, row = len (entries), ...)
entries.append (entry)
body.grid_columnconfigure (0, weight = 1, minsize = ...)
body.grid_columnconfigure (1, weight = 5, minsize = ...)
boy.pack (...)
Shouldn't be any harder for a different toolkit, as long as it
offers decent geometry management.
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list