Title: Signature.html
Thanks. Very good. That'll give me something to think about. Where is
your namespace tutorial?
Alan Gauld wrote:
"Wayne
Watson" <sierra_mtnv...@sbcglobal.net> wrote
Image
<class Image.Image at 0x00EA5720>
help(Image)
Help on class Image in module Image:
...
This is definitely different than the Tkimage help you showed.
So what's happening?
You import your Image module as Image.
Then you import all; the names from Tkinter which includes the name
Image. Thus the Tkinter Imahe hides the original imported Image.
You need to either
import Image as im # or some other alias
or not use from Tkinter, ie use
import Tkinter as T
Then use T.Image to refer to the Tkinter Image and im to refer to the
imported Image module
Its all about controlling namespaces.
It is exactly because of these kinds of problems that the from X import
* style is considered a bad idea. (In Tkinter it usually works because
the names are pretty GUI specific but if, as you are doing, you mix GUI
and graphics you get overlaps.
How do I use the two Image classes to
navigate between an image that uses PIL methods and one than uses
Tkinter?
Just use the appropriate module prefix (or an alias)
See the namespaces topic in my tutor for a refresher on namespaces! :-)
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
Copper and its alloys have been found effective in hospital
sinks, hand rails, beds, ... in significantly reducing
bacteria. Estimates are 1/20 people admitted to a hospital
become infected, and 1/20 die from the infection.
-- NPR Science Friday, 01/16/2009
Web Page: <www.speckledwithstars.net/>
|
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor