[Tutor] How Do I Put an Image on a Canvas and Display it?

Alan Gauld alan.gauld at btinternet.com
Mon Jan 26 10:53:45 CET 2009


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote 

I'm not familiar with the Image and ImageDraw modules 
but what I think is happening is...

> import Image, ImageDraw
> from Tkinter import *

By doing this you have hidden Image because Tkinter has 
its own Image class.

> im = Image.open("wagon.tif")

This is calling open() on Tkinter.Image

You need to either import Image as an alias or
use import Tkinter instead of from Tkinter.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld.



More information about the Tutor mailing list