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() 출력
위의 코드를 실행하면 메인 창 앞에 Toplevel 창이 표시됩니다.
