From: Armin on 10 May 2010 17:01 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(a)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!
From: Armin on 11 May 2010 12:57 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(a)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!
From: Antoine Pitrou on 11 May 2010 13:08 On Tue, 11 May 2010 09:57:01 -0700 Armin <amphioxus(a)yahoo.com> 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.
|
Pages: 1 Prev: [Epydoc-devel] How to? epydoc --top=README Next: Difference between 'is not' and '!=' ? |