Implicit initialization is EVIL!

rantingrick rantingrick at gmail.com
Sun Jul 3 18:11:09 EDT 2011


Tkinter has a major flaw and this flaw has been with us for many many
years. What is the flaw? Well the title says it all folks... IMPLICIT
INITIALIZATION IS EVIL. Still confused, well let me explain.

Unlike most GUI libraries the Tkinter developers thought is would
"just wonderful" if the root GUI window just sprang into existence if
the programmer "somehow" forgot to create one. Does anyone remember
the old adage...

   """ The road to hell is paved with good intentions? """

...as you're about to see this road is paved in gold around thee
parts!  You're probably thinking to yourself that i am stretching the
truth for the sake of drama? Well i wish i could answer yes, but i
cannot. So without further "a due" let me show you some code...

## START CODE ##
from Tkinter import *
label = Label(parent=None, text='This is an example of poor GUI
design!')
label.pack()
label.mainloop()
## END CODE ##

As you can see the root window is auto created for the caller and this
sort of hand holding only served to confuse the hell of out new folks!
Sure it's "cute" (and all that type of nifty swiftly crap!) but it is
EVIL! A new user should learn from day one the hierarchy of a GUI.

-root window
-optional widgets
--optional sub windows
---optional widgets
---and on and on

root = Tk() # Or a derived class of Tk
frame = Frame(root)
w = Widget(frame)
and on and on and on

We should never propagate this sort of confusion throughout our
community. Please remove this dangerous design pattern immediately.



More information about the Python-list mailing list