"Jay" wrote:
> Now I just get this error message.
>
> AttributeError: 'int' object has no attribute 'image'
>
> But the picture appears so I am almost their.
>
> ---START---
>
> from Tkinter import *
>
> class App:
> def __init__(self, root):
> self.MainFrame = Canvas(root)
> self.MainFrame.pack(fill=BOTH, expand=1)
>
> BackgroundFile = PhotoImage(file="Background.GIF")
> Background = self.MainFrame.create_image(0, 0,
> image=BackgroundFile)
> Background.image = BackgroundFile # keep a reference!
the example on that page attaches the image to a widget instance,
not a canvas object handle (which is an integer; unlike user-defined
classes, integers don't allow you to attach arbitrary attributes to
them).
if you just want to display a single image, just attach it to self:
BackgroundFile = PhotoImage(file="Background.GIF")
Background = self.MainFrame.create_image(0, 0, image=BackgroundFile)
self.image = BackgroundFile # keep a reference!
if you want to display multiple images on the canvas, use a dictionary
or a list to hold active image references.
</F>
--
http://mail.python.org/mailman/listinfo/python-list