Problem displaying jpgs in Tkinter via PIL
Armin
amphioxus at yahoo.com
Mon May 10 17:01:10 EDT 2010
Hi everyone,
I'm new to Python and have been playing around with it using the
Enthought Python distribution for Mac OS X 10.6.3 (EPD academic
license, version 6.1 with python 2.6.4).
It's been great learning the basics, but I've started running into
problems when I'm trying to use the PIL library with Tkinter. All I'm
trying to do is display a JPG as a Tkinter label:
# code below:
from Tkinter import *
import Image, ImageTk
def main():
filename = "images/testimg.jpg"
imgPIL = Image.open(filename)
root = Tk()
imgTK = ImageTk.PhotoImage(imgPIL)
label = Label(root, image=imgTK)
label.pack()
root.mainloop()
main()
# end of code
It all works fine when I'm just using GIF images through Tkinter's
photoimage object, but as soon as I'm trying to convert an image
through ImageTk, I get the following error:
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/PIL/_imagingtk.so,
2): Library not loaded: /System at rpath/Tcl Referenced from:
/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/PIL/_imagingtk.so
Reason: image not found
I have no idea what that means, but I've always assumed the EPD
includes all the stuff that's needed to make Tkinter work with PIL.
Any advice would be greatly appreciated. Thanks!
More information about the Python-list
mailing list