Language: Python
Hello There!
This is my code
from tkinter import *
window = Tk()
# you cant set iamages to tkinter directly
# so, you need to create a label
photo = PhotoImage(file="duck.jpg")
label = Label(window, image=photo)
label.pack()
window.mainloop()
The error I get -
Traceback (most recent call last):
File "d:/development/Python/TheNewBoston/Python/GUI/1/script6.py", line 8, in <module>
photo = PhotoImage(file="duck.jpg")
File "C:\Users\hirusha\AppData\Local\Programs\Python\Python38\lib\tkinter\__init__.py", line 4061, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "C:\Users\hirusha\AppData\Local\Programs\Python\Python38\lib\tkinter\__init__.py", line 4006, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "duck.jpg"
Link to the image i downloaded - https://image.shutterstock.com/image-photo/mallard-duck-clipping-path-colourful-260nw-1384212383.jpg
what I wan't to do? -
I just simply want to display that image of the duck in my program! like this - This is what i want to do
I am new to python! i know how to read some simple errors.. but i don't understand what they say here..
Any help is appreciated, Thank You!