Fredrik Lundh wrote:
The Tkinter module contains a "Image" class, so doing the "import *"
thing after all other imports will stomp out the Import module.
Either fix all uses of PIL to use fully qualified names (replace
"import Image" with "import PIL.Image", "Image.open" with
"PIL.Image.open" etc), or, easier, move the "from Tkinter import *"
line to the top of the imports.

but then you can't access the Tkinter Image class.

"import *" is a bad idea, plain and simple, and this is why!

"Namespaces are one honking great idea -- let's do more of those"

note: that's not "less of those".

EVERY package I work with that used to recommend "import *", no longer does: numpy, wxPython, matplotlib, ....

I'd do something like:

import PIL
import PIL.Image as Image

img=Image.open('white dragon.png')

(By the way, is "import Image" depreciated? it should be.)


import Tkinter as TK

root=TK.Tk()

etc.


-Chris



--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to