Bonjour,
j'essaie de réaliser un qui est ce mais je suis bloqué.
Je voudrai savoir comment faire correspondre ma liste "personnages" avec leur photo correspondantes dans les canvas.
personnages = array([['Belle','fille','marron','long','chatain','sans'],['Elsa','fille','bleu','long','blond','sans'],['John','garcon','marron','court','blond','sans'],['Eric','garcon','bleu','court','brun','sans'],['Peter Pan','garcon','marron','court','roux','avec'],['tarzan','garcon','marron','long','chatain','sans'],['Mulan','fille','marron','long','brun','sans']])
fenetre = Tk()
fenetre.title('Jeu : Qui est ce ? ')
fenetre.geometry("1200x800")
quiestce=random.choice(6)
print (quiestce)
print (personnages[quiestce][0])
strReponseOuiNon=StringVar()
strReponsePrenom=StringVar()
strReponseOuiNon.set("")
photo = PhotoImage(file = 'belle.gif')
photo1 = PhotoImage(file = 'elsa.gif')
photo2 = PhotoImage(file = 'john.gif')
photo3 = PhotoImage(file = 'eric.gif')
photo4 = PhotoImage(file = 'peterpan.gif')
for i in range(4):
for j in range(6):
canvas = Canvas(fenetre, width =130, height =130, bg ='white')
canvas.create_image(65, 65, image =photo)
canvas.grid(row=0, column=0)
canvas1 = Canvas(fenetre, width =130, height =130, bg ='white')
canvas1.create_image(65, 65, image =photo1)
canvas1.grid(row=0, column=1)
canvas2 = Canvas(fenetre, width =130, height =130, bg ='white')
canvas2.create_image(65, 65, image =photo2)
canvas2.grid(row=0, column=2)
canvas3 = Canvas(fenetre, width =130, height =130, bg ='white')
canvas3.create_image(65, 65, image =photo3)
canvas3.grid(row=0, column=3)
canvas4 = Canvas(fenetre, width =130, height =130, bg ='white')
canvas4.create_image(65, 65, image =photo4)
canvas4.grid(row=0, column=4)
canvas5 = Canvas(fenetre, width =130, height =130, bg ='white')
canvas5.create_image(65, 65, image =photo5)
canvas5.grid(row=0, column=5)