[Image-SIG] Creating a Transparent Image and Placing it Over Another Image (txt)

Christopher Barker Chris.Barker at noaa.gov
Thu Apr 9 19:46:02 CEST 2009

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




Christopher Barker, Ph.D.

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.Barker at noaa.gov

More information about the Image-SIG mailing list