I'm creating a program and am trying to set a image as the background of my window. The window is inside a function which is connected to a button so when its clicked it redirects to the new window... Normally with the code not being in a function it works fine, but when I put it in a function it all breaks and doesn't work.
Here is the broken code of the function:
heres the code
def login_sucess():
menu_window = Tk()
main_screen.destroy()
menu_window.geometry("800x800")
menu_window.title("Main Menu")
bg = PhotoImage(file="menuwindowbg.png")
my_label = Label(menu_window, image=bg)
my_label.place(x=0,y=0, relwidth=1, relheight=1)
menu_window.mainloop()