Oct-28-2020, 06:58 PM
Probably I found the error:
img = PhotoImage(file = content)
#_tkinter.TclError: couldn't open " ....#ÿÙ": filename is invalid on this platform
print(type(img),img)
However, I'm not sure how can I fix it :(
img = PhotoImage(file = content)
#_tkinter.TclError: couldn't open " ....#ÿÙ": filename is invalid on this platform
print(type(img),img)
However, I'm not sure how can I fix it :(
(Oct-28-2020, 06:16 PM)deanhystad Wrote: Have you tried to determine where the error is happening? First I would do this:
def openImg(): fileimg = filedialog.askopenfile(mode = 'rb+', initialdir = "/Desktop/",title = "Select file",filetypes = (("jpeg files","*.jpg"),("png", "*.png"))) print(type(fileimg), fileimg) return content = fileimg.read() img = PhotoImage(file = content) my_label = Label(image = img).grid(row = 3, column = 0)If fileimg is a file I would move the print and return to see what you are getting back for content.
If that looks good I would move things down and look at img.
I think you are going to find that you are providing the wrong kind of argument to one of the function calls. Hint Hint