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
   | import csv
from tkinter import *
 
 
fen1 = Tk()
def afficher():
 
#Extraction de mes données CSV
     t = csv.reader(open('liste.csv', 'r'), delimiter=';')
    for row in t:
        photo = PhotoImage(file =row[0]+'.gif')
        n=0
        i=0
#J'essais de faire une boucle pour afficher mes images comme une matrice grâce à grid()
        while i==i :
            can= Canvas(fen1, width =150, height =190, bg ='white')
            item =can.create_image(80, 80, image =photo)
            if n<9:
                can.grid=(row==i,colomn==n) #NameError: global name 'colomn' is not defined
            n=n+1
        i=i+1
        fen1.mainloop()
 
 
bou=Button(fen1, text="afficher trombinoscope",command=afficher)
bou.pack()
fen1.mainloop() | 
Partager