OK, in reference to my last thread, I finally got PIL installed and set up. I can even successfully import it (from PIL import Image). All that remains to be done is for me to successfully get an image into my GUIs, and I'll be good to go.

Can someone link me to a helpful thread or website?

ETA: I am having trouble figuring this out. I have the following as a "test" code, before I apply PIL to my main code:

import PIL
from PIL import Image
from PIL import ImageDraw

im = Image.open("1.gif")
im.show()
print 'done.'

This is EXACTLY what a sample program has, with the lone exception of the file. And yet my program pops up the Microsoft Windows Viewer but shows no picture. Why?

Back to the main program, here is what I am trying to run:

if adjMines>0:
                self.square[x][y]['text'] = adjMines
                try:
                    if adjMines == 3:
                        im = Image.open("3.bmp")
                except (IOError):
                    print 'File missing.'
                else:
                    if adjMines == 3:
                        self.square[x][y]['text'] = ''
                        self.square[x][y]['image'] = im

Here is the error message that line 11 triggers:

TclError: image "<PIL.BmpImagePlugin.BmpImageFile image mode=P size=15x15 at 0x2D88918>" doesn't exist

What does that mean, and how do I work through it?

Maybe the image file you are trying to load doesn't exist.

Other than, that, I have no clue what is wrong since I have never worked with PIL or cpython imaging.

When you use ...

from PIL import Image

im = Image.open("1.gif")
im.show()

The PIL function show() works this way:
PIL will save a random_file.bmp in a temporary file and then use the image viewer associated with .bmp files to show the image.

You may not have an image viewer associated with a .bmp file on your system.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.