Bonsoir,
J'ai fait un petit programme avec Tkinter qui permettrai d'afficher une image lorsque l'utilisateur entrerai '2' dans le champs de texte. Mais l'image ne s'affiche pas et j'ai cette erreur "AttributeError: type object 'Image' has no attribute 'open'"

Voici mon programme :

--------------------------------

Code : 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
28
29
30
31
from tkinter import *
 
i=''
 
dicimg = {}
 
 
def valider():
    i=saisi.get()
    print (i)      
    if i=='2':
 
        im=Image.open("molly.png") 
        photo = ImageTk.PhotoImage(im) 
        dicimg['img1'] = photo
        item = cadre.create_image(320,240,image =photo) 
        print("charger image")
 
 
fen1=Tk()
 
value = StringVar() 
value.set("Entrez la référence")
 
saisi=Entry(fen1, textvariable=value)
saisi.pack()
 
 
bouton1=Button(fen1, text="Valider", command=valider)
bouton1.pack()
fen1.mainloop()
------------------------------------

Une aide serai la bienvenue. Bonne soirée Rom