from Tkinter import * from PIL import Image , ImageTk def pendue(): global a global liste global liste2 saisi1=saisi.get() a=saisi1 liste=["s","o","u","s"," ","l","a"," ","m","o","n","t","a","g","n","e"] liste2=["_ ","_ ","_ ","_ "," ","_ ","_ "," ","_ ","_ ","_ ","_ ","_ ","_ ","_ ","_ "] list_test=[] vie=8 b=0 while vie<>0: list_test.append(a) for i in range (len(liste)): if liste[i]==a: liste2[i]=a b=3 if b<>3: vie=vie-1 b=0 else: vie=vie b=0 print vie jolie(liste2) return a def lettre1(): Prout=Label(fen2,textvariable=lettre) Prout.pack() def jolie(liste): mot="" for i in range (len(liste)): mot=mot+liste[i] print mot mot=StringVar() w=Label(fen2,textvariable=mot) w.pack() def test(): global a saisi1=saisi.get() saisi2.set(saisi1) a=saisi1 print a fen2=Tk() photo2=Image.open("marche.jpg") photo21=ImageTk.PhotoImage(photo2) canvas=Canvas(fen2,width=800, height=600) canvas.create_image(400,300, anchor=CENTER, image=photo21) canvas.pack() texte1=Label(fen2,text="Demandez une lettre") texte1.pack() lettre=StringVar() saisi=Entry(fen2, textvariable=lettre) saisi.pack() a=lettre.get() bouton1=Button(fen2,text="Proposez",command=pendue) bouton1.pack() saisi2=StringVar() txt=Label(fen2,textvariable=saisi2) txt.pack() fen2.mainloop()