FAQ
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!

Search Discussions

  • Armin at May 11, 2010 at 4:57 pm
    Never mind, I gave up on Tkinter and have switched to wxPython now.
    Getting jpg images to display in a wx frame worked like a charm... (As
    I said, I'm very new to Python, so I didn't really know what my options
    for GUI programming were.)

    It seems like the ImageTk module on the Enthought distribution on my
    Mac is broken, but I can't figure out how to fix that. (I wiped my
    python installations and did a re-install, all to no avail.) As long as
    I don't need Tkinter for the GUI I'm envisioning, I don't really care
    however.



    On 2010-05-10 14:01:10 -0700, Armin said:
    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:

    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!
  • Antoine Pitrou at May 11, 2010 at 5:08 pm

    On Tue, 11 May 2010 09:57:01 -0700 Armin wrote:
    Never mind, I gave up on Tkinter and have switched to wxPython now.
    Getting jpg images to display in a wx frame worked like a charm... (As
    I said, I'm very new to Python, so I didn't really know what my options
    for GUI programming were.)
    You might also want to try PyQT, which is often considered more modern
    than wxPython (I've never tried it, though).

    Regards

    Antoine.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMay 10, '10 at 9:01p
activeMay 11, '10 at 5:08p
posts3
users2
websitepython.org

2 users in discussion

Armin: 2 posts Antoine Pitrou: 1 post

People

Translate

site design / logo © 2023 Grokbase