Simple Tkinter app works in Linux, not in Windows

john.orlando at gmail.com john.orlando at gmail.com
Thu Feb 9 23:42:24 EST 2006


> I'm inclined to think that its your python installation. It worked for
> me with both the cygwin python (both in the console and in an xterm) and
> it also worked for me with idle using enthought python. I haven't tried
> the active state python.

Thanks for giving it a shot.  I just checked the version of Python I
was using: 2.3.4 under Linux, and 2.4.2 under Windoze.  So there is a
difference here I guess, though I'd be surprised if it were actually
any kind of "fix" between the two versions.

As a side note, under Win, if I don't put the code in a class it seems
to work fine. In other words:
#start code
from Tkinter import *
win = Tk()
img = PhotoImage(file="moon.gif")
can = Canvas(win)
can.create_image(2,2,image=img, anchor=NW)

#no requirement for keeping an instance of the image around here

win.mainloop()
#end code

...and I get a moon displayed in the top-level window.  This got me
wondering if I was misusing the Frame and/or Canvas widget in some
fashion (since obviously there is no Frame in the above snippet).

Any other thoughts out there?

TIA,
John




More information about the Python-list mailing list