Re: Problem compiling Tkinter program with bmp images using py2

2006-01-26 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

> 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

(did you try googling for the error message?)

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

it's PIL that's complaining, not Tkinter.  PIL uses dynamic loading of format
drivers, which means that py2exe won't find them.  the easiest way to fix
this is to import the drivers you need in your main program; see e.g.

http://starship.python.net/crew/theller/moin.cgi/PIL_20and_20py2exe





-- 
http://mail.python.org/mailman/listinfo/python-list


Problem compiling Tkinter program with bmp images using py2

2006-01-25 Thread [EMAIL PROTECTED]
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



-- 
http://mail.python.org/mailman/listinfo/python-list