如何在 Tkinter 中從標題欄中移除圖示?
若要移除 Tkinter 視窗的預設圖示,我們可以透過指定屬性型別使用 wm_attributes('type', 'value') 方法。在以下示例中,我們將使用 '-toolwindow'(一個布林值,用於移除與應用程式標題欄關聯的圖示)。
示例
#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('-toolwindow', 'True')
win.mainloop()輸出
當我們執行以上程式碼時,它將顯示一個 Tkinter 視窗,且標題欄中沒有它的預設圖示。
![]()
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP