Problème d'affichage d'images avec Tkinter
Bonjour, je dois créer une interface graphique pour une application qui dois afficher les images d'un fichier avec une checkbox en dessous, ainsi qu'un bouton terminer pour fermer l'application.
Malheuresement, dans mon code, mon interface graphique n'affihche seulement que 15 images et pas plus.
De plus ma CheckBox et mon Bouton ne s'affiche pas :/
je vous joint mon code ci-dessous :
Code:
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
| import tkinter
from PIL import Image, ImageTk
import os
folder_path = '/home/admin01/Images/test/'
x=0
y=0
imagelist=[] #tenter de créer une classe pour rendre ca plus propre
root = tkinter.Tk()
for path, dirs, files in os.walk(folder_path):
for file in files:
canvas = tkinter.Canvas(root)
canvas.grid(row = x, column = y)
check = tkinter.CheckButton(root,state=DISABLED,text = " ")
check.grid(row = x, column = y)
image = Image.open(folder_path + file)
photo = ImageTk.PhotoImage(image)
imagelist.append(photo)
canvas.create_image(128,128, image=photo)
if(y<5):
y = y+1
else:
x = x+1
y = 0
print(file + " " + str(x) + " " +str(y))
bouton=tkinter.Button(root, text="Terminer",anchor = tkinter.SE, command= root.quit)
root.mainloop() |
Merci par avance pour votre aide,
Florian