Need help with canvas widget in Tkinter please
flounder
flounder_pounder at telebot.com
Sat Jan 1 22:20:07 EST 2000
I cannot seem to figure out how to add images to a canvas with python/Tkinter
I can do it with Tcl/Tk and Perl/Tk but not with python i have tried this but
it did not work at all. Here is the code i used
-----------CODE--------------
#!/usr/bin/python
from Tkinter import *
mw = Tk()
mw.title("Map Editor")
photo = PhotoImage(file="tile0.gif")
display = Canvas(mw, width=640, height=480).pack()
item = display.create_image(0, 0, anchor=NW, image=photo)
image = display.addImage
mainloop()
--------------END OF CODE---------------
when i run this it gives me this error
-----------ERROR MESSAGE--------------
Traceback (innermost last):
File ".//test.py", line 11, in ?
item = display.create_image(0, 0, anchor=NW, image=photo)
AttributeError: 'None' object has no attribute 'create_image'
-----------END OF ERROR---------------
can anyone show me how this should be done I have looked at the
documentation and can't figure it out
Thanks in advance
--
Flounder
More information about the Python-list
mailing list