Bonjour,

j'essaye un code simple mais je bloque sur un truc.

Code python : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
from tkinter import*
 
def cartes():
 
    img=PhotoImage(file='3_carreau.gif')
    can.create_image(50,70,image=img)
 
    can.create_line(10,200,400,200,fill='light yellow',arrow=LAST)
 
 
 
# Fenêtre :
fen= Tk()
 
 
#Canvas:
can=Canvas(fen,width=500,height=500)
can['bg']='black'
can.pack()
 
#Bouton:
b=Button(fen,text="Donne",command=cartes)
#b["command"]=cartes
b.pack(pady=5)
 
fen.mainloop()

Pourquoi l'image ne s'affiche pas ?

merci