Problem compiling Tkinter program with bmp images using py2

E

erkidevries

Problem compiling Tkinter program with bmp images (using py2exe)

I have a Tkinter gui program that uses bmp as backgrounds.

The program itself works when I run from the source.
I placed the .bmp files in the same folder as the script.
I run my .py script (from IDLE) and all the backgrounds are loaded as intended.

in my script I load the images like this:

root = Tk()
im = PIL.Image.open('backg2.bmp')
photo1 = PIL.ImageTk.PhotoImage(im)

iminfo = PIL.Image.open('backg3.bmp')
photo2 = PIL.ImageTk.PhotoImage(iminfo)

imlabel = PIL.Image.open('backg4.bmp')
photo4 = PIL.ImageTk.PhotoImage(imlabel)
....

and put them on the widgets like this:

Label(win, text=message, background=rgb(150,150,120), image=photo2).pack()
....

Now, I want the same program to run as exe file on another computer, so I compiled it with py2exe.
I copied the bmp's to the same folder as my executable.
When I try to run the compiled exe i get:

Traceback (most recent call last):
File "make_ma2.py", line 461, in ?
File "PIL\Image.pyo", line 1745, in open
IOError: cannot identify image file

Are there specific things to take care of when compiling a tkinter program with bitmap backgrounds?

thanks,
tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top