import tkinter as tk # python 3
from tkinter import StringVar, font as tkfont # python 3
from tkinter import messagebox
from PIL import ImageTk, Image
#################################################################second window
window=tk.Tk()
window.title("title")
window.geometry("1500x800")
RadioVariety_2=tk.IntVar()
radio1=tk.Radiobutton(window, text="1번", value=1, variable=RadioVariety_2)
radio1.place(x=40,y=550)
def new_page():
window = tk.Toplevel()
window.grab_set()
#########################################################################frist window
mainWindow = tk.Tk()
TitlePhoto = tk.PhotoImage(file="TitlePhoto.png")
Title = tk.Label(mainWindow, image = TitlePhoto)
Title.image = TitlePhoto
Title.place(x=230,y=50)
mainWindow.mainloop()
error message
File "c:\Users\y\Desktop\project\stackoverflow.py", line 36, in <module>
Title = tk.Label(mainWindow, image = TitlePhoto)
File "C:\Users\y\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 2766, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "C:\Users\y\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 2299, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: image "pyimage1" doesn't exist
I want to make a new window in a tkinter.
I have a file in the same folder, but error occurs.
What should I do?