如何在不使用 overrideredirect() 方法的情況下移除 Tkinter 視窗中的標題欄?
要移除 Tkinter 視窗的標題欄,我們可以使用wm_attributes('type', 'value') 方法,指定屬性的型別。在如下示例中,我們會使用 'fullscreen',一個移除視窗標題欄的布林值。
示例
#Import the tkinter library
from tkinter import *
#Create an instance of tkinter frame
win = Tk()
win.geometry("700x350")
#Create a Label to print the Name
label= Label(win, text="This is a New Line Text", font= ('Helvetica 14 bold'), foreground= "red3")
label.pack()
win.wm_attributes('-fullscreen', 'True')
win.mainloop()輸出
執行上述程式碼會顯示一個無標題欄的全屏視窗。

廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP