I've written the following code by taking reference from this question
from tkinter import *
def main():
def hide_me(event):
event.widget.pack_forget()
root = Tk()
btn=Button(root, text="Click")
btn.bind('<Button-1>', hide_me)
btn.pack()
btn2=Button(root, text="Click too")
btn2.bind('<Button-1>', hide_me)
btn2.pack()
btn3=Button(root,text="reload",command=main)
btn3.pack()
root.mainloop()
main()
but what I want is when I hit that reload button program will restart from beginning in the same window but it's starting in the new window. And when I've not declared root inside main then it'll restart with a chain of reload buttons.
please help. Thanks In advance.