Hi! When I am running this code, the output looks how I expected it to be, but the problem is that I cannot go back to home page whenever I want to. I dont know why but when I tried to go back to home page after visiting the tips and challenge, it wont worked anymore. the program suddenly closed. what can i do? help me:(

from tkinter import *
from PIL import ImageTk

class Home:
    def __init__(self,root):
        self.root=root 
        self.root.title("Moneyfestation-Home")
        self.root.geometry("1590x850+0+0")
        self.root.resizable(False,False)

        self.root.image=ImageTk.PhotoImage(file="home.jpg")
        self.root.label=Label(root,image=root.image)
        self.root.label.pack()

        headingFrame1 = Frame(self.root,bg="#E5F6DF",bd=6)
        headingFrame1.place(relx=0.2,rely=0.1,relwidth=0.6,relheight=0.16)

        headingLabel1 = Label(headingFrame1, text="MONEYFESTATION", bg="#acdf87", fg='black', font=('Impact',50))
        headingLabel1.place(relx=0,rely=0, relwidth=1, relheight=1)

        headingFrame2=Frame(self.root,bg="white",bd=0).place(x=300,y=300)
        headingLabel2=Label(headingFrame2, text="About The System",bg="#e4e7d2",fg="#193C0D",font=('times new roman',20,"bold")).place(x=550,y=250)

        headingFrame3=Frame(self.root,bg="#E5F6DF",bd=4)
        headingFrame3.place(x=330,y=300,height=300,width=650)

        headingLabel3=Label(headingFrame3, text="Moneyfestation is an expense tracker and budget planner system", bg="#acdf87", fg="#193C0D", font=('times new roman',14,"bold"))
        headingLabel3.place(relx=0,rely=0, relwidth=1, relheight=1)

        btn1 = Button(self.root,cursor="hand2",text="Tips",command=self.tips,bg="#66a103",fg='white',font=('times new roman',18,"bold"),borderwidth=10)
        btn1.place(x=1000,y=320,height=70,width=280)

        btn2 = Button(self.root,cursor="hand2",text="Challenge",command=self.challenge,bg="#66a103", fg='white',font=('times new roman',18,"bold"),borderwidth=10)
        btn2.place(x=1000,y=410,height=70,width=280)

        btn3 = Button(self.root,cursor="hand2",text="Sign Out",command=self.logout,bg="#66a103", fg='white',font=('times new roman',18,"bold"),borderwidth=10)
        btn3.place(x=1000,y=500,height=70,width=280)

    def tips(self):
        self.root.destroy()
        import tips

    def challenge(self):
        self.root.destroy()
        import challenges

    def logout(self):
        self.root.destroy()
        import logout

root=Tk()
obj=Home(root)
root.mainloop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.