Problem with Tkinter.PhotoImage

Cédric Lucantis omer at no-log.org
Fri Jan 11 15:48:34 CET 2008


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



More information about the Python-list mailing list