Не надо ничего удалять и создавать заново. Надо просто расположить окна одно над другим и показывать нужное в нужный момент:
import tkinter as tk
class WizardLikeApp(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
container = tk.Frame(self)
container.pack(side='top', fill='both', expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (StartPage, PageOne, PageTwo):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky='nsew')
self.show_frame(StartPage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
class StartPage(tk.Frame):
def __init__(self, parent, controller):
super().__init__(parent)
label = tk.Label(self, text='Start Page')
label.pack(pady=10, padx=10)
button = tk.Button(self, text='Visit Page 1',
command=lambda: controller.show_frame(PageOne))
button.pack()
button2 = tk.Button(self, text='Visit Page 2',
command=lambda: controller.show_frame(PageTwo))
button2.pack()
class PageOne(tk.Frame):
def __init__(self, parent, controller):
super().__init__(parent)
label = tk.Label(self, text='Page One')
label.pack(pady=10, padx=10)
button1 = tk.Button(self, text='Back to Home',
command=lambda: controller.show_frame(StartPage))
button1.pack()
button2 = tk.Button(self, text='Page Two',
command=lambda: controller.show_frame(PageTwo))
button2.pack()
class PageTwo(tk.Frame):
def __init__(self, parent, controller):
super().__init__(parent)
label = tk.Label(self, text='Page Two')
label.pack(pady=10, padx=10)
button1 = tk.Button(self, text='Back to Home',
command=lambda: controller.show_frame(StartPage))
button1.pack()
button2 = tk.Button(self, text='Page One',
command=lambda: controller.show_frame(PageOne))
button2.pack()
app = WizardLikeApp()
app.mainloop()