bonjour

Entrefaite je vaudrai que lorsque je traduit un mot l'image du mot apparaît

voici mon code
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#PROTOTYPE 1 TKINTER
 
# 0. MODULES IMPORTES ######################################################
 
import tkinter as tk
 
#1. OUVRIRE LISTE ############################################################################################
dico_fr_it = {"bonjour":"buongiorno" , "au revoir":"arrivederci" , "salut":"ciao" ,
              "train":"Treno" , "bus":"Autobus" , "voiture":"Macchina" , "velo":"Bicicletta",
              "banque":"Banca" ,"gare":"Stazione" , "hotel":"Albergo" , "bateau":"Nave",
              "hôpital":"Ospedale" ,"hier":"Ieri","non merci":"No grazie" , "de rien":"Prego",
              "argent":"Soldi" , "avion":"Aereo"}
"""
Tableau_images = [],
Tableau_images.append()=tk.PhotoImage(file="images/bonjour.png"),
Tableau_images.append()=tk.PhotoImage(file="images/au revoir.png"),
Tableau_images.append()=tk.PhotoImage(file="images/salut.png"),
Tableau_images.append()=tk.PhotoImage(file="images/train.png"),
Tableau_images.append()=tk.PhotoImage(file="images/bus.png"),
Tableau_images.append()=tk.PhotoImage(file="images/voiture.png"),
Tableau_images.append()=tk.PhotoImage(file="images/velo.png"),
Tableau_images.append()=tk.PhotoImage(file="images/banque.png"),
Tableau_images.append()=tk.PhotoImage(file="images/gare.png"),
Tableau_images.append()=tk.PhotoImage(file="images/hotel.png"),
Tableau_images.append()=tk.PhotoImage(file="images/bateau.png"),
Tableau_images.append()=tk.PhotoImage(file="images/hôpital.png"),
Tableau_images.append()=tk.PhotoImage(file="images/hier.png"),
Tableau_images.append()=tk.PhotoImage(file="images/hier.png"),
Tableau_images.append()=tk.PhotoImage(file="images/non merci.png"),
Tableau_images.append()=tk.PhotoImage(file="images/de rien.png"),
Tableau_images.append()=tk.PhotoImage(file="images/argent.png"),
Tableau_images.append()=tk.PhotoImage(file="images/avion.png")
"""
#2.FONCTION ################################################################################################
#2.1.Elle sera appelée à chaque fois que l'utilisateur appuie sur le bouton
def afficher_traduction(dictionnaire, entry, label): 
    def wrap():
        mot_traduit = dictionnaire.get(entry.get().lower(), "Mot non trouvé ou mal orthographié")
 
        label["text"] = mot_traduit
    return wrap
 
#2.3.Le corps du programme
fenêtre = tk.Tk()
fenêtre.geometry("525x200")
#fenêtre.minsize("600x300")
fenêtre.title("Traducteur Français Italien")
"""
fenêtre['bg']='red'
"""
canevas1=tk.Canvas(fenêtre,height=400,width=400)
canevas1["bg"]="grey"
canevas1.place(x=300, y=5)
Tableau_images=tk.PhotoImage(file="images/avion.png")
image1=canevas1.create_image(100,100,image =Tableau_images, anchor="center")
 
 
entree_utilisateur = tk.Entry(width=30)
affichage = tk.Label(width=20)
btn_equivalence = tk.Button(fenêtre, text="appuyez ici pour traduire", command=afficher_traduction(
                                                         dico_fr_it, entree_utilisateur, affichage))
 
#2.4Placement des widgets dans la fenêtre
 
entree_utilisateur.place(x=20, y=20)
btn_equivalence.place(x=40, y=50)
affichage.place(x=20, y=90)
 
#3.SORTIE################################################################################
fenêtre.mainloop()