Simple Tkinter app works in Linux, not in Windows

john.orlando at gmail.com john.orlando at gmail.com
Fri Feb 10 11:34:43 EST 2006


> There is a difference between the above code and your prior code, namely
> in that you have explicitly instantiated Tk and put your canvas into the
> "root" toplevel. Try this in idle where it was failing:

<snip>

Problem solved...I tried James' suggestion (explicitly instantiating
the root Tk window, and then running the mainloop() as suggested), but
it produced the same result i.e. no photo.  Ugghhhh...

I then looked REALLY closely at my code and noticed that my __init__
function was actually ___init___ (3 underscores instead of 2).  Thus, a
Frame object was being built, but the __init__ function wasn't getting
run.  So no image was ever getting added.  Silly underscores...or,
silly Python newbie  :-)  It now works under both Linux and Windoze
just fine.

I would have thought that having no __init__ function would flag an
error, but I guess this isn't necessary.  I thought about grabbing PDB
to debug, and I bet this would have shown the error immediately (i.e.,
it would never have called the function).  Being a newbie is such a
joy...

Thanks for the help,
John




More information about the Python-list mailing list