Problem with PIL/Tkinter Program Example

W. eWatson notvalid2 at sbcglobal.net
Thu Apr 9 11:52:33 EDT 2009


Peter Otten wrote:
> W. eWatson wrote:
> 
>> Something is amiss here. The program produces a canvas in which one can
>> move an object around. The input file is hard coded (see open). If you
>> want to try it, you'll need to provide a file. Python error below. Name
>> space difficulty?
> 
>> Traceback (most recent call last):
>>    File
>> "C
> \Sandia_Meteors\Sentinel_Development\Development_Sentuser-Utilities\Playground\fun-move_object.py",
>> line 45, in <module>
>>      Demo(root)
>>    File
>> "C
> \Sandia_Meteors\Sentinel_Development\Development_Sentuser-Utilities\Playground\fun-move_object.py",
>> line 35, in Demo
>>      data.img=ImageTk.PhotoImage(img)
>> NameError: global name 'ImageTk' is not defined
> 
> If you want to use the ImageTk module you have to import it first:
> 
>> #Mouse movement
>> from Tkinter import *
>> import PIL
>> import Image
> 
>   import ImageTk
> 
> [rest of your code here]
> 
> Peter
Very good. Thanks.

-- 
                                W. eWatson

              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

                     Web Page: <www.speckledwithstars.net/>




More information about the Python-list mailing list