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
| from tkinter import*
fen=Tk()
fen.title('cryptage des templiers'),
fen.geometry('1600x900')
canv=Canvas(height=900,width=1500)
canv.grid(row=1,column=1,rowspan=10,columnspan=10)
fichierimg1=PhotoImage(file="croix_patte.gif")
img=canv.create_image((780,450),image=fichierimg1,anchor="center")
canv1=Canvas(height=200,width=300,bg="red")
canv1.grid(row=8,column=2,rowspan=2,columnspan=3)
saisie=StringVar()
E=Entry(fen,textvariable=saisie, width=30)
E.grid(row=3,column=3)
def crypter():
fiche = {"a":"A1","b":"A2"}
#mot=saisie.get()
mot="ba"
for i in range (len(mot)):
#print(mot[i])
print(fiche.get(mot[i]))
fichierimg=[]
for i in range(len(fiche.get(mot[i]))):
fichierimg.append(PhotoImage(file=fiche.get(mot[i])+".gif"))
Image=[]
for i in range (len(fiche.get(mot[i]))):
Image.append(canv1.create_image(10+i*25,10,image=fiche.get(mot[i])+'.gif'))
print(fichierimg[i])
B2=Button(fen,text="valider",width=20,command=crypter)
B2.grid(row=6,column=4)
fen.mainloop() |
Partager