I want to make image sorter in tkinter: There would be image in the center 2 buttons in the bottom ["one; two"] and when I will press first button that image will go to the folder "one"
I have tried many variants but cant solve this problem; here is example
import tkinter as tk
from PIL import ImageTk, Image
from os import listdir
size= 700, 700
window = tk.Tk()
window.title("Join")
window.geometry("700x700")
window.minsize(700,700)
window.maxsize(700,700)
bottomFrame = tk.Frame(window)
bottomFrame.pack(fill=tk.X, side=tk.BOTTOM)
for i in range(2):
bottomFrame.columnconfigure(i, weight=1)
#commands
def one():
print("one")
im.save("one/"+ path)
def two():
print("two")
im.save("two/"+ path)
#loop
imagesList = listdir("all/")
for path in imagesList:
print("test")
im = Image.open("all/" + path)
im.thumbnail(size, Image.ANTIALIAS)
img = ImageTk.PhotoImage(im)
label = tk.Label(window, image = img)
label.pack(side = "top", fill = "both", expand = "true")
bluebutton = tk.Button(bottomFrame, text="one", fg="blue", command=one)
bluebutton1 = tk.Button(bottomFrame, text="two", fg="blue", command=two)
bluebutton.grid(row=0, column=0, sticky=tk.W+tk.E)
bluebutton1.grid(row=0, column=1, sticky=tk.W+tk.E)
window.mainloop()