I am trying to code a return to home screen button while closing the current window but I am getting "newWindow is not defined". I am able to navigate to new menus while closing the home screen but not the other way around.
def cardinfobutt() works but def home() doesnt
Heres my code:
root = Tk()
def home():
root = Tk()
root.geometry("600x300")
root.maxsize(600, 300)
root.minsize(600, 300)
root.title("eBot")
newWindow.destroy()
def cardinfobutt():
newWindow = Tk()
newWindow.title("Card Information")
newWindow.geometry("600x300")
Label(newWindow, text="Card Information").pack()
homebutton = Button(newWindow, text="Back to Home Screen", padx=50, pady=50, command=home, fg="black", bg="white")
homebutton.pack()
root.destroy()
tried to use the same process home screen -> other menus, get newWindow is not defined.
def cardinfobutt() works but def home() doesnt.