afficher une image dans un canvas
Bonjour,
Je commence tout juste avec Python, et je ne comprend pas pourquoi lorsque je clique sur afficher, image1.gif n'apparait pas dans le canvas:
from Tkinter import *
import Tix
root = Tix.Tk()
canvas=Canvas(root,width="500",height="400")
canvas.pack()
#********************************************************************************
def afficher():
p=PhotoImage(file="image.gif")
canvas.create_image(0,0,anchor=NW,image=p)
#********************************************************************************
#bouton bAfficher:
bAfficher = Button(root, text='Afficher image',command=afficher )
bAfficher.pack()
root.mainloop()
Quelque chose qui m'echappe...