2

I've installed pillow on Ubuntu 14.04. I'm using python 2.7 for this project. There is no ImageTk module, although the pillow web site says there is. python finds PIL all right, but when I try to import ImageTk, the PIL compatibility layer (or whatever I should call it) tries to import the ImageTk module from the PIL module, and it's not there. Other modules like Image, ImageChops and so on, are there.

I need the ImageTk module so that I can use JPEGs with tkinter. What do I need to do? Alternatively, using pillow can I create PhotoImages from JPEGs in tkinter without the ImageTk module? How?

I've copied a terminal session below in case I haven't explained myself well. Thanks for any assistance.

$ pip show pillow
---
Name: Pillow
Version: 2.3.0
Location: /usr/lib/python2.7/dist-packages
Requires: 
saul@Banach:~ 
$ python2
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> from PIL import ImageTk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name ImageTk
>>> import ImageTk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/PILcompat/ImageTk.py", line 1 in <module>
from PIL.ImageTk import *
ImportError: No module named ImageTk
>>> quit()
saul@Banach:~ 
$ cat /usr/lib/python2.7/dist-packages/PILcompat/ImageTk.py
from PIL.ImageTk import *
saul@Banach:~ 
$ ls /usr/lib/python2.7/dist-packages/PIL/ImageTk*
ls: cannot access /usr/lib/python2.7/dist-packages/PIL/ImageTk*: No such file or directory
saulspatz
  • 5,011
  • 5
  • 36
  • 47

0 Answers0