im trying to go another frame and go back to first frame with button.(like next page.)
i can go second frame easily but i cant go back to mainframe. i tried it with place_forget() and destroy(). but when i use them i cant see my mainframe.
which func i need to go back to mainframe named "messageWindow"
here is part of my code:
messageWindow= Tk()
messageWindow.title("İstanbul")
messageWindow.geometry("400x600")
messageWindow.resizable(width=False,height=False)
frame1 = Frame(messageWindow, width =400, height=100, relief = tkinter.FLAT)
frame1.pack(side=TOP, expand= True, fill=BOTH)
frame2 = Frame(messageWindow, width =400, height=500, relief = tkinter.FLAT)
frame2.pack(side=TOP, expand= True, fill=BOTH)
def goSearchBarButton():
searchbarFrame = Frame(messageWindow,width =400, height=600, relief = tkinter.FLAT)
searchbarFrame.place(x=0,y=0)
nframe1 = Frame(searchbarFrame, width =400, height=100, relief = tkinter.FLAT)
nframe1.pack(side=TOP, expand= True, fill=BOTH)
nframe2 = Frame(searchbarFrame, width =400, height=500, relief = tkinter.FLAT, background="black")
nframe2.pack(side=TOP, expand= True, fill=BOTH)
def goBack():
nframe1.destroy()
nframe2.destroy()
backIcon1 = PhotoImage(file="backIcon.png")
backIconButton1 = Button(nframe1,image=backIcon1, command= goBack)
backIconButton1.image= backIcon1
backIconButton1.place(x=0, y=14)
searchbarIcon = PhotoImage(file="searchbar.png")
searchbarIconButton= Button(frame2, image = searchbarIcon, command= goSearchBarButton)
searchbarIconButton.place(x=40,y=30)backIcon=PhotoImage(file="backIcon.png")
backIconButton = Button(frame1, image=backIcon)
backIconButton.place(x=0,y=14)
messageWindow.mainloop()
What I have tried:
i tried it with place_forget() and destroy()