this propgram loops throught 9 photos and put them into a button after editing it into 200x280 size
here is the code of the program
from tkinter import *
from PIL import Image, ImageTk
shelf = Tk()
shelf.title("shelf")
shelf.configure(bg="#00dbff")
left_scroll = Button(shelf,text="<",font=("Arial", 16),height=7*4,width=4).grid(row = 0,rowspan=4,column=0,padx=10,pady=10)
right_scroll = Button(shelf,text=">",font=("Arial", 16),height=7*4,width=4).grid(row = 0 ,rowspan=4,column=4,padx=10,pady=10)
i = 1
j = 1
book_counter = 1
while(j<4):
image_book = Image.open("F:\\Libary\\books image\\{number}.jpg".format(number = book_counter))
image_book = image_book.resize((200,280))
s = 'F:\\Libary\\books image\\{number}Edit.jpg'.format(number = book_counter)
image_book.save(s)
book1 =ImageTk.PhotoImage(file =s)
Button(shelf,image=book1,borderwidth=0).grid(row = j,column=i,padx=10,pady=15)
i+=1
book_counter += 1
if(i == 4):
j+=1
i=1
shelf.mainloop()
i tried removing the variables and the part where it change the size and saving it amd used the saved file did't work tried to but Imagetk.photoImage(file = s) in the image = in button didnt work