제목 표시줄 없이 tkinter 창을 만들려면 tkinter 창 상단에서 탐색 패널을 비활성화하는 overrideredirect(boolean) 속성을 사용할 수 있습니다. 그러나 사용자가 창 크기를 즉시 조정할 수는 없습니다.
프로그래밍 방식으로 제목 표시줄 없이 크기를 조정할 수 있는 창을 만들어야 하는 경우 Sizegrip(parent)을 사용할 수 있습니다. Tkinter의 위젯. 사이즈 그립 위젯은 사용자가 기본 창을 당겨 크기를 조정할 수 있도록 하는 확장성을 응용 프로그램에 추가합니다. Sizegrip 으로 작업하려면 위젯을 사용하려면 마우스 버튼과 그립을 당길 때마다 창 크기를 조정하는 기능을 바인딩해야 합니다.
예시
# 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")
# Remove the Title bar of the window
win.overrideredirect(True)
# Define a function for resizing the window
def moveMouseButton(e):
x1=winfo_pointerx()
y1=winfo_pointery()
x0=winfo_rootx()
y0=winfo_rooty()
win.geometry("%s x %s" % ((x1-x0),(y1-y0)))
# Add a Label widget
label=Label(win,text="Grab the lower-right corner to resize the window")
label.pack(side="top", fill="both", expand=True)
# Add the gripper for resizing the window
grip=ttk.Sizegrip()
grip.place(relx=1.0, rely=1.0, anchor="se")
grip.lift(label)
grip.bind("<B1-Motion>", moveMouseButton)
win.mainloop() 위의 코드를 실행하면 제목 표시줄이 없는 창이 표시됩니다. 오른쪽 하단 모서리에서 그립을 당겨 이 창의 크기를 조정할 수 있습니다.
출력
