I want to switch between two frames instead of creating a new window.I just want to stay in same window and after some button is pressed then the another frame is to be switched.I tried some code but i am getting some error can somebody help me to fix or edit the code
from tkinter import * def raise_frame(frame): frame.tkraise() root1 = Tk() root1.geometry('500x500') root1.title("Registration Form") root = Frame(root1).pack() f2 = Frame(root1).pack() label_0 = Label(root, text="Registration form",width=20,font=("bold", 20)) label_0.place(x=90,y=53) label_1 = Label(root, text="FullName",width=20,font=("bold", 10)) label_1.place(x=80,y=130) entry_1 = Entry(root) entry_1.place(x=240,y=130) label_2 = Label(root, text="Email",width=20,font=("bold", 10)) label_2.place(x=68,y=180) entry_2 = Entry(root) entry_2.place(x=240,y=180) label_3 = Label(root, text="Gender",width=20,font=("bold", 10)) label_3.place(x=70,y=230) var = IntVar() Radiobutton(root, text="Male",padx = 5, variable=var, value=1).place(x=235,y=230) Radiobutton(root, text="Female",padx = 20, variable=var, value=2).place(x=290,y=230) label_4 = Label(root, text="country",width=20,font=("bold", 10)) label_4.place(x=70,y=280) list1 = ['Canada','India','UK','Nepal','Iceland','South Africa']; c=StringVar() droplist=OptionMenu(root,c, *list1) droplist.config(width=15) c.set('select your country') droplist.place(x=240,y=280) label_4 = Label(root, text="Programming",width=20,font=("bold", 10)) label_4.place(x=85,y=330) var1 = IntVar() Checkbutton(root, text="java", variable=var1).place(x=235,y=330) var2 = IntVar() Checkbutton(root, text="python", variable=var2).place(x=290,y=330) Button(root, text='Submit',width=20,bg='brown',fg='white', command=lambda:raise_frame(f2)).place(x=180,y=380) label_8 = Label(f2, text="Welcome to page 2",width=20,font=("bold", 10)) label_8.place(x=70,y=230) root1.mainloop()what should i write to change to frame 2 if the button is pressed in first frame