Not sure what is wrong with my code (Tkinter BEGINNER) <p>I'm making a pretty simple GUI and each frame should have a Continue and Exit button. I need the continue button to open a new frame with writing, widgets...etc on it. </p> <p>The first frame (<code>frame1</code>) works when I call the <code>frame_2</code> function.<br> But from this I do not know how to open a <code>frame_3</code> and destroy <code>frame 2</code> properly.</p> <p>Here is the code so far:</p> <pre><code>import tkinter from tkinter.constants import * tk = tkinter.Tk() def frame_2(): #ENTERING AGE frame1.grid_forget() frame1.destroy() frame2 = tkinter.Frame(tk, borderwidth=2,) frame2.pack(fill=BOTH,expand=1,pady=50,padx=80) need_info = tkinter.Label(frame2, text="I need some information first...") need_info.grid(row=0, column=0) #displays text at top of frame enter_age = tkinter.Label(frame2, text="Please enter your age!") enter_age.grid(row=2, column=0) #displays second line of text age = tkinter.Entry(frame2, width=10) age.grid(row=3, column=0) nextpage = tkinter.Button(frame2,text="Continue",command=frame2.destroy) nextpage.grid(row=10, column=0) exitapp = tkinter.Button(frame2,text="Exit",command=tk.destroy) #exits programme exitapp.grid(row=12, column=0) def frame_three(): #ENTERING EDUCATION frame_2().grid.forget() frame_2().destroy() frame3 = tkinter.Frame(tk, borderwidth=2) frame3.pack(fill=BOTH,expand=1,pady=50,padx=80) def frame_3(): #ENTERING EDUCATION frame_2().grid.forget() frame_2().destroy() frame3 = tkinter.Frame(tk, borderwidth=2) frame3.pack(fill=BOTH,expand=1,pady=50,padx=80) age_confirm = tkinter.Label(frame3, text="You entered 38!") age_confirm.grid(row=0, column=0) nextpage.grid(row=10, column=0) exitapp = tkinter.Button(frame2,text="Exit",command=tk.destroy) #exits programme exitapp.grid(row=12, column=0) frame1 = tkinter.Frame(tk, borderwidth=2) #WELCOME PAGE, a.k.a The first frame frame1.pack(fill=BOTH,expand=1,pady=50,padx=80) label = tkinter.Label(frame1, text="Welcome to NAME GAME! I'm going to guess who you are...") label.grid(row=0, column=0) #displays text at top of frame nextpage = tkinter.Button(frame1,text="Continue",command=frame_2) def frame_2(): #ENTERING AGE frame1.grid_forget() frame1.destroy() frame2 = tkinter.Frame(tk, borderwidth=2,) frame2.pack(fill=BOTH,expand=1,pady=50,padx=80) need_info = tkinter.Label(frame2, text="I need some information first...") need_info.grid(row=0, column=0) #displays text at top of frame enter_age = tkinter.Label(frame2, text="Please enter your age!") enter_age.grid(row=2, column=0) #displays second line of text age = tkinter.Entry(frame2, width=10) age.grid(row=3, column=0) nextpage = tkinter.Button(frame2,text="Continue",command=frame_3) nextpage.grid(row=10, column=0) exitapp = tkinter.Button(frame2,text="Exit",command=tk.destroy) #exits programme exitapp.grid(row=12, column=0) nextpage.grid(row=2, column=0) exitapp = tkinter.Button(frame1,text="Exit",command=tk.destroy) #exits programme exitapp.grid(row=4, column=0) tk.mainloop() </code></pre>