I have tried to open an image in python here is code:
from tkinter import *
from PIL import ImageTk, Image
main = Tk()
main.geometry("500x500")
main.title("Geometry Helper")
main.config(bg="Light Green")
img = PhotoImage(Image.open("C:\\Users\\Lenovo User\\Downloads\\Geommy Dash.PNG"))
Yoeshabite = Label(main, image=img)
label1 = Label(main, text="Geometry Dash Helper", font=" Verdana 12", bg="Light Green").place(x=155,y=130)
label2 = Label(main, text="An app designed by MellowMoex", bg="Light Green").place(x=155,y=150)
eeeeeEe = Button(main, text="Search", bg="Dark Green", command="Searchj").place(x=155,y=170)
eeeeEEe = Button(main, text="Level requests", bg="Green").place(x=206,y=170)
main.mainloop()
But It flags up this error:
Traceback (most recent call last):
File "c:\Users\Lenovo User\OneDrive - Colchester Royal Grammar School\Documents\Geometyr dash.py", line 8, in <module>
Yoeshabite = Label(main, image=img)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 3148, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 2572, in __init__
self.tk.call(
TypeError: __str__ returned non-string (type PngImageFile)