[Pythonmac-SIG] PIL icns plugin can't display icns file

Kevin Walzer kw at codebykevin.com
Mon Jan 7 20:05:46 CET 2008


I'm testing Bob Ippolito's icns plugin for PIL, and am running into 
difficulty. I can't get an icon to display: in fact, Python crashes when 
I try to load the icon and display it.

Here is a test script, using a Tkinter GUI (Python 2.5.1, Tk 8.5, OS X 
10.5.1):

---
from Tkinter import *
import Image, ImageTk

root = Tk()

im = Image.open('/Users/kevin/Desktop/vuman.icns')
newim = im.resize((16, 16))

labelimage = ImageTk.PhotoImage(newim)

w = Label(root,  text="My Test Icon", image=labelimage, width=100)
w.image=labelimage
w.pack()

mainloop()

---

And here's the crash message in Terminal:

Macintosh:Desktop kevin$ python iconlabel.py
alloc: invalid block: 0x5c32b4: 5d 0 0

Abort trap

I'm not sure what is causing Python to barf here. PIL is supposed to be 
able to create valid Tkinter photo objects, so I don't think the issue 
is with Tk not recognizing the icns format. Any suggestions?


-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com


More information about the Pythonmac-SIG mailing list