I have written this.
Its short and supposed to open a file dialog window, with buttons "open a file, turn, save, exit." I want to open a jpeg, turn it 180° and then save it and quit.
The program starts, but doesnt open the picture in the file dialog window after I select it in the browser.
from tkinter import *
from PIL import Image, ImageTk
from tkinter import ttk
from tkinter import filedialog
from tkinter.filedialog import askopenfilenames
root = Tk() ##pro Tkinter
root.title('Image Browser')
root.geometry('100x100')
def open():
global my_image
root.filename = filedialog.askopenfilenames(initialdir='/gui/pillow', filetypes=[('Images','*.jpg *.jpeg *.png')])
#my_label = Label(root, text = root.filename).pack()
my_image = ImageTk.PhotoImage(Image.open(root.filename))
my_image_label = Label(image=my_image).pack()
def turn():
return
my_image = my_image.transpose(Image.FLIP_RIGHT_LEFT)
def save():
return
my_image.save('somepic.jpg')
button = Button (root, text = 'Select a File', command = open)
button.pack()
button4 = Button (root, text = 'Turn', command = turn)
button4.pack()
button2 = Button (root, text = 'Save', command = save)
button2.pack()
button3 = Button(root, text = 'Exit', command = jadro.quit)
button3.pack()
root.mainloop()
After I select and try to open the file, it says this
AttributeError: 'tuple' object has no attribute 'seek'
I feel like I've tried everything, but cant seem to solve it. Thanks for any help