Toplevel tạo cửa sổ con (child window) kế thừa thuộc tính cửa sổ cha. Tạo bằng Toplevel(parent).
Ví dụ
# Import thư viện
from tkinter import *
# Tạo khung chính
win = Tk()
win.geometry("700x250")
def open_win():
top = Toplevel(win)
top.geometry("700x250")
top.title("Child Window")
Label(top, text="Hello World!").pack()
Label(win, text="Click the button to Open Popup Window", font=('Helvetica 18')).place(relx=.5, rely=.5, anchor=CENTER)
Button(win, text="Click Me", background="white", foreground="blue", font=('Helvetica 13 bold'), command=open_win).pack(pady=50)
win.mainloop()Kết quả
Cửa sổ chính có nút. Click mở cửa sổ con Toplevel.

