R
rantingrick
I just installed Python 3,0 on my machine. I cannot use 3.0
exclusively yet however i was interested in just poking around and
acquiring a taste if you will. I was happy to find that the new
Tkinter module names now follow convention and are placed correctly...
example: "tkinter.simpledialog"
However some things never change it seems and some improvements are
actually a step backwards. The same problems with the unit test in 2.x
got ported to 3.x. And the new SimpleDialog is just more lackluster
code like we've seen before. I was hoping to be amazed, i am
disappointed and disgusted. It is obvious that whoever is writing/
maintaining the tkinter code base does NOT understand tkinter
completely and this is blinding apparent by reading the source code!
-----------
Issues
-----------
First lets start with the problems that migrated from 2.x...
(tkinter.simpledialog)
#-- ISSUE 1 --#
In the test() function we still have code that uses the "quit" method
instead of "destroy". Calling the "quit" method only tells Tkinter to
stop processing events, IT DOES NOT DESTROY THE WIDGET!! And on
windows the the root will then become unresponsive -- you cannot close
the window, you cannot do anything. I have said time and time again.
DO NOT USE THE QUIT METHOD UNLESS YOU KNOW WHAT THE HECK YOU ARE
DOING! So the code needs to be this...
OLD:
q = Button(root, text='Quit', command=t.quit)
NEW:
q = Button(root, text='Quit', command=root.destroy)
#-- ISSUE 2: --#
The author used a very strange method by which to denote the default
button in the SimpleDialog class. He choose to set the relief to RIDGE
and the border "8". This not only looks horrible (and exposes the
authors ignorance of tkinter) but a much more elegant solution is
provided by the TclTk folks. All buttons have a "default" option that
will display the button with a nice border so the user can visually
see which button is active. So the code should be this....
OLD:
if num == default:
b.config(relief=RIDGE, borderwidth=8)
NEW:
if num == default:
b.config(default=ACTIVE)
Last but not least i am puzzled as to why we choose the method name
"go" over "show". for "showing" the dialog. SimpleDialog uses no
inheritance so name clashes are mum. Why would anyone choose "go" over
"show" for a modal dialog? I would really like an explanation for
this.
Other minor issues exists. I may describe them later. At this time we
need to fix these grave abominations first.
exclusively yet however i was interested in just poking around and
acquiring a taste if you will. I was happy to find that the new
Tkinter module names now follow convention and are placed correctly...
example: "tkinter.simpledialog"
However some things never change it seems and some improvements are
actually a step backwards. The same problems with the unit test in 2.x
got ported to 3.x. And the new SimpleDialog is just more lackluster
code like we've seen before. I was hoping to be amazed, i am
disappointed and disgusted. It is obvious that whoever is writing/
maintaining the tkinter code base does NOT understand tkinter
completely and this is blinding apparent by reading the source code!
-----------
Issues
-----------
First lets start with the problems that migrated from 2.x...
(tkinter.simpledialog)
#-- ISSUE 1 --#
In the test() function we still have code that uses the "quit" method
instead of "destroy". Calling the "quit" method only tells Tkinter to
stop processing events, IT DOES NOT DESTROY THE WIDGET!! And on
windows the the root will then become unresponsive -- you cannot close
the window, you cannot do anything. I have said time and time again.
DO NOT USE THE QUIT METHOD UNLESS YOU KNOW WHAT THE HECK YOU ARE
DOING! So the code needs to be this...
OLD:
q = Button(root, text='Quit', command=t.quit)
NEW:
q = Button(root, text='Quit', command=root.destroy)
#-- ISSUE 2: --#
The author used a very strange method by which to denote the default
button in the SimpleDialog class. He choose to set the relief to RIDGE
and the border "8". This not only looks horrible (and exposes the
authors ignorance of tkinter) but a much more elegant solution is
provided by the TclTk folks. All buttons have a "default" option that
will display the button with a nice border so the user can visually
see which button is active. So the code should be this....
OLD:
if num == default:
b.config(relief=RIDGE, borderwidth=8)
NEW:
if num == default:
b.config(default=ACTIVE)
Last but not least i am puzzled as to why we choose the method name
"go" over "show". for "showing" the dialog. SimpleDialog uses no
inheritance so name clashes are mum. Why would anyone choose "go" over
"show" for a modal dialog? I would really like an explanation for
this.
Other minor issues exists. I may describe them later. At this time we
need to fix these grave abominations first.