CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

[Python] Liste avec canvas

benchoux
benchoux
Niveau 1
25 mai 2015 à 19:35:46

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)


Sous forums
  • Aide à l'achat Mac
  • Internet
  • Macintosh
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Steam Deck
  • Hardware
La vidéo du moment