[Tkinter] loading .jpg image?

Gerrit Holl gerrit at nl.linux.org
Sun Jan 5 22:04:33 CET 2003


Hi,

What do I need to load a .jpg with Tkinter?

Demo/tkinter/guido/imageview.py will not do it...

$ file /usr/share/wallpapers/Blkmarble.jpg
/usr/share/wallpapers/Blkmarble.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, 0 x 0
$ python imageview.py /usr/share/wallpapers/Blkmarble.jpg
Traceback (most recent call last):
  File "imageview.py", line 12, in ?
    main()
  File "imageview.py", line 7, in main
    img = PhotoImage(file=filename)
  File "/usr/local/lib/python2.3/lib-tk/Tkinter.py", line 3137, in __init__
    apply(Image.__init__, (self, 'photo', name, cnf, master), kw)
  File "/usr/local/lib/python2.3/lib-tk/Tkinter.py", line 3093, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "/usr/share/wallpapers/Blkmarble.jpg"

yours,
Gerrit.

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list