import os
import tkinter as tk
used_list = []
image_list= os.listdir("Faces")
class_names = []
for file in image_list:
class_names.append(os.path.splitext(file)[0])
add_key = 0
width = '400'
height = '800'
width_int = int(width)
height_int = int(height)
but_height = height_int / len(image_list)
but_width = width_int / len(image_list)
lbl_add = but_height / 2
but_width = int(but_width)
but_height = int(but_height)
root = tk.Tk()
root.geometry(f"{width}x{height}")
for fle in class_names:
def fun2():
print(fle)
cur_but = tk.Button(root,width = but_width,height = height_int,bg='#8a081e',command = lambda:[fun2()])
cur_but.place(x = 0,y = add_key)
add_key += but_height
for thing in class_names:
txt = tk.Label(root,text = f"{thing}",bg='#8a081e',fg = 'white')
txt.place(x = (width_int / 2) - 30,y =lbl_add)
lbl_add += but_height
big_text = tk.Label(root,text = ' Pick Two Files to see if both people have matching faces',width = 100,height = 5, anchor='w')
big_text.place(x=0,y=0)
root.mainloop()
this if my code , but the only thing getting appended is only one of the files in the directory, can i give each button a certain special entity to call it later