473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 5493
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: midtoad | last post by:
I'm trying to display a GIF image in a label as the central area to a Tkinter GUI. The image does not appear, though a space is made for it. Why is this so? I notice that I can display a GIF...
5
by: eesun | last post by:
Hi, I've downloaded the dislin package for the scientific plotting. And I have already created the application window with Tkinter (menu, canvas, status bar..). I want to integrate the Dislin...
0
by: erkidevries | last post by:
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...
6
by: Dustan | last post by:
Nobody answered last time. I guess they wanted me to give it a shot. Well, here is how I download the image (it's a class method): def download_image(self):...
2
by: sj | last post by:
I am just learning to use Tkinter and am having problems displaying image files. I am able to display an image using tutorials (such as http://www.daniweb.com/code/snippet296.html) But when I try...
2
by: Kevin Walzer | last post by:
I am trying to create a number of Tk PhotoImages from a single directory. Currently I am hard-coding file names and image names, like so: def makeImages(self): self.imagedir = (os.getcwd() +...
3
by: Nebulism | last post by:
Hi everyone, I am working on a module for my GUI that shows one image with an index value below and would use a scrollbar to control which of the images are displayed. The images are stored in a...
2
by: skanemupp | last post by:
why is the first program not working? when i click the screen the map is not appearing. the second program works. from Tkinter import * master = Tk()
1
by: jimgardener | last post by:
hi I am using Python 2.5.1. In my code i want to use self.myimage=PhotoImage (file=self.myfile) so i can create the image in a canvas self.mycanv.create_image(70,100,image=self.myimg) it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.