Как перейти с одной страницы на другую в приложении?

У меня есть готовая форма авторизации на Python, используя библиотеку tkinter. Как я можно сделать, что бы когда пользователь авторизовался, то открывался другой шаблон, с другим оформлением и функциями?

from tkinter import *

main_window = Tk()
main_window.geometry("900x700")
main_window.title('Почта')
main_window.resizable(width=False, height=False)

window_background = PhotoImage(file='sky.png')
window_background = window_background.subsample(1, 1)

canvas = Canvas(main_window, width=900, height=700)
canvas.create_image(0, 0, image=window_background)
canvas.create_text(450, 200, text='Добро пожаловать в Почту!', font='Etna 17', fill="#EEF3F8")
profile = PhotoImage(file="prof.png")
canvas.create_image(315, 250, image=profile)
mail_log = Entry(main_window, width=41)
mail_log.place(x=340, y=240)
profile2 = PhotoImage(file="lock.png")
canvas.create_image(315, 290, image=profile2)
mail_pass = Entry(main_window, width=41)
mail_pass.place(x=340, y=280)
b0 = Button(main_window, height=1, width=20, text="Войти", command=login_mail, 
bg="white").place(x=390, y=320)
canvas.pack()

main_window.mainloop()

Ответы (1 шт):

Автор решения: Сергей

Можно как-то так: from tkinter import ttk

def login_mail():

    main_window.withdraw()  # прячем основное окно
    t = Toplevel(main_window)  # создаем новое окно верхнего уровня
    n = ttk.Notebook(t)  # если нужно несколько окон
    n.pack(pady=10, expand=True)
    f1 = ttk.Frame(n, width=400, height=280)
    f2 = ttk.Frame(n, width=400, height=280)
    f1.pack(fill='both', expand=True)
    f2.pack(fill='both', expand=True)
    n.add(f1, text='One')
    n.add(f2, text='Two')
    t.protocol("WM_DELETE_WINDOW", main_window.destroy)  # закрываем основное окно
→ Ссылка