[Image-SIG] im.show does not show, and Tkinter isn't displaying my jpg image

Stanley Sokolow overbyte at earthlink.net
Sun Mar 16 01:08:06 CET 2008


I'm stumped, and it seems it should be so simple.  I've been building a GUI
with Pmw and Tkinter, and I reached a point where I want to display a jpg
image on a Label object.  I've followed the rules and examples carefully,
importing the right modules, creating, packing, etc., but no image.  The
code will display a text string in the label, but not an image.  I get no
error messages.  So I tried a simple PIL test case:

import Image
im = Image.open("sampleImage.jpg")
im.show()

I'm running Python 2.5.1 on Windows Vista with PIL 1.1.6 installed (verified
with Image.VERSION).   I get no error messages.  I should see the image in
Windows Photo Gallery, but the gallery says only "There are no pictures or
videos selected" when PIL runs it.  Windows does display the sampleImage.jpg
file when I click the file name in Windows Explorer, so it doesn't seem to
be a bad photo file.  It's in the same directory as the test program, so the
path is correct.

I tried adding a forced load:
import Image
im = Image.open("sampleImage.jpg")
pix = im.load()
im.show()

But no different results.  Still no image.   So I added a "print im"
statement, which confirms that an image object was created:
<JpegImagePlugin.JpegImageFile instance at 0x014B3C10>

What am I doing wrong?   Can anyone suggest anything else to check?
-- 
View this message in context: http://www.nabble.com/im.show-does-not-show%2C-and-Tkinter-isn%27t-displaying-my-jpg-image-tp16074034p16074034.html
Sent from the Python - image-sig mailing list archive at Nabble.com.



More information about the Image-SIG mailing list