หน้าต่าง Tkinter Toplevel สร้างหน้าต่างเพิ่มเติมนอกเหนือจากหน้าต่างหลัก เราสามารถเพิ่มวิดเจ็ตและส่วนประกอบในหน้าต่างระดับบนสุดที่สร้างขึ้นใหม่ได้ รองรับคุณสมบัติทั้งหมดของหน้าต่างหลักหรือหน้าต่างหลัก
บางครั้งหน้าต่างระดับบนสุดยังถูกเรียกว่าหน้าต่างลูก ในการวางหน้าต่างลูกไว้หน้าหน้าต่างหลัก เราสามารถใช้ wm_transient() วิธีการ
ตัวอย่าง
# Import the required libraries
from tkinter import *
from tkinter import ttk
# Create an instance of tkinter frame or window
win=Tk()
# Set the size of the window
win.geometry("700x350")
win.title("Parent Window")
# Create a Toplevel window
top=Toplevel(win)
top.geometry('600x250')
top.title("Child Window")
# Place the toplevel window at the top
top.wm_transient(win)
win.mainloop() ผลลัพธ์
หากเราเรียกใช้โค้ดข้างต้น จะแสดงหน้าต่างระดับบนหน้าหน้าต่างหลัก
