Вот код:
def start1():
start = Toplevel()
# start.overrideredirect(1)
start.state('zoomed')
start.config(bg="khaki")
start.bind("<KeyPress>", lambda event: start.destroy())
image1 = ImageTk.PhotoImage(file="1.jpg")
do = Label(start, image=image1)
do.place(x = 0, y = 0, relwidth=1, relheight=1)
start.mainloop()
screen = Tk()
# root.overrideredirect(1)
screen.state('zoomed')
screen.config(bg="peachpuff")
image1 = ImageTk.PhotoImage(file="1.jpg")
do = Label(screen, image=image1, width=300, height=300)
do.place(x=5, y=10)
image2 = ImageTk.PhotoImage(file="1.png")
do_b = Button(screen, image=image2, command=start1)
do_b["border"] = "0"
do_b.place(x=105, y=325)
screen.mainloop()
Вот ошибка:
image2 = ImageTk.PhotoImage(file="1.png")
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PIL\ImageTk.py", line 89, in __init__
image = _get_image_from_kw(kw)
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PIL\ImageTk.py", line 58, in _get_image_from_kw
return Image.open(source)
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PIL\Image.py", line 2809, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '1.png'
Exception ignored in: <function PhotoImage.__del__ at 0x00000269AD0DF4C8>
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PIL\ImageTk.py", line 118, in __del__
name = self.__photo.name
AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'
Помогите пожалуйста!