Am 07.12.18 um 03:00 schrieb Paulo da Silva:
Às 21:15 de 06/12/18, Rick Johnson escreveu:
I kinda have a love/hate relationship with Tkinter and IDLE.
On one hand i find them to be practical[2] and simple[3] and
on the other, i find them to be poorly designed and
unintuitive. And it's a real shame, because, both of these
libraries have tons of potential, *IF*, they were designed
probably and the shortcomings of TclTk were abstracted away
behind a more Pythonic interface.
hahaha...
I'm using Tk from both Tcl and Python, and to me it seems like exactly
the other way around. Tkinter feels clumsy compared to the "original"
Tcl/Tk, because of some overzealous OOP-wrapping. "grid" is a good
example; in Tcl, it is not a member of the widgets but instead a free
function. It can take more than one slave, so, for instance
grid .x .y .z
grid .a x .b
creates a 3x2 grid of widgets with the lower middle cell empty. No
fiddling with row and column counting. For some strange reason the
Tkinter designers decided that grid should be a method of the slave,
which makes it feel much more clumsy.
I fully agree. Nevertheless, what I miss more is the lack of more
complex mega widgets - scrollable list of widgets with insert, append
and remove methods and perhaps a spreadsheet like widget are two big
ones. There are others smaller, like a single scrollable text with two
scroll bars that hide when not needed, tab multi-choice container, etc ...
These widgets do exist for Tcl/Tk. You can use a tablelist for both a
list of widgets or a multi-column listbox
https://wiki.tcl-lang.org/page/tablelist
For the spreadsheet, TkTable is another solution which is more close to
Excel:
https://wiki.tcl-lang.org/page/Tktable
"Tab multi-choice container" sounds to me like a ttk::notebook widget
https://wiki.tcl-lang.org/page/notebook
Another handy extension is TkDnD, which brings support for native
Drag'n'drop, i.e. you can drop files from a file manager into your
application:
https://github.com/petasis/tkdnd
- not to be confused with a cheap substitute
https://kite.com/python/docs/Tkdnd which only supports drag/drop within
one application instance.
The "problem" with these pacakges, they are written in Tcl and/or C, is
that they are not distributed along the Tk core and consequently there
are no well-maintained Python wrappers availabe. In the Tcl community,
these packages are considered "essential" for more complex GUI
programming. So instead of complaining about lacking support in Tk, the
Python community should do their homework and provide wrappers to the
most common Tk extensions.
Christian
--
https://mail.python.org/mailman/listinfo/python-list