471,350 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Problem with Tkinter.PhotoImage

Hi,

I can only load gif images with Tkinter.PhotoImage and none with BitmapImage.
I tried png, jpg, bmp and xpm and always got this errors :
>>img = Tkinter.PhotoImage(file='/home/omer/fgfs/fgsync/map.xpm')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 3206, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 3162, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image
file "/home/omer/fgfs/fgsync/map.xpm"

(or _tkinter.TclError: format error in bitmap data with BitmapImage)

I also tried the imageview demo with the bitmaps in Demo/tix/bitmaps and same
result (only works with tix.gif). Sounds weird that tkinter only supports a
non-free format... Am I lacking some packages or config ? I'm on a debian sid
and have the following python packages installed :

libboost-python1.34.1
python
python-central
python-doc
python-imaging
python-imaging-tk
python-minimal
python-mode
python-newt
python-selinux
python-semanage
python-support
python-tk
python2.4
python2.4-doc
python2.4-minimal

thanks,
--
Cédric Lucantis
Jan 10 '08 #1
2 5387
Cédric Lucantis wrote:
Hi,

I can only load gif images with Tkinter.PhotoImage and none with BitmapImage.
I tried png, jpg, bmp and xpm and always got this errors :
That's because Tk only supports the gif format natively. You need to
install an additional photo library to support additional images (Tk has
an Img extension, and Python Image Library is also very good).

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jan 10 '08 #2
Cédric Lucantis wrote:
Hi,

I can only load gif images with Tkinter.PhotoImage and none with BitmapImage.
I tried png, jpg, bmp and xpm and always got this errors :
That's because Tk only supports the gif format natively. You need to
install an additional photo library to support additional images (Tk has
an Img extension, and Python Image Library is also very good).

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jan 10 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by eesun | last post: by
2 posts views Thread by sj | last post: by
2 posts views Thread by Kevin Walzer | last post: by
1 post views Thread by jimgardener | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.