Bonjour, je n'arrive pas à importer une image dans une canevas. merci pour votre aide


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
# --------------------------------------------------------------------
# creation image photo
# --------------------------------------------------------------------
image = PIL.Image.open("kard.png")
photo = PIL.ImageTk.PhotoImage(image)
 
# --------------------------------------------------------------------
# creation canvas
# --------------------------------------------------------------------
self.canphoto = Canvas(self.fenetre, width = photo.width(), height = photo.height())
self.canphoto.create_image(40, 60, anchor=NW, image=photo)
self.canphoto.grid(row=1, column=1, rowspan=2, padx=20, pady=60,sticky = W)