2

I've been searching for hours jumping from site to site from video to video searching for something that would work. Simply nothing worked for me!

from tkinter import *
import tkinter.messagebox

root = Tk()

photo = PhotoImage(file='download.jpg')
label = Label(root, image = photo)
label.pack()

root.mainloop()
Error:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 "/Users/Datboi/PycharmProjects/untitled2/Tkinter test.py"
Traceback (most recent call last):
  File "/Users/Datboi/PycharmProjects/untitled2/Tkinter test.py", line 6, in <module>
    photo = PhotoImage(file='download.jpg')
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3539, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3495, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "download.jpg"

Process finished with exit code 1

https://i.stack.imgur.com/EATSQ.jpg

Im just simply trying to display a picture in certain dimensions but it doesn't recognise the image file. I'm searching for alternatives.

El pupper
  • 23
  • 6

0 Answers0