如何在操作系统工具栏中更改 Tkinter 的默认标题?
Tkinter 应用程序窗口包含许多组件:窗口大小、标题、导航栏、菜单栏组件等。若要配置窗口属性,我们可以使用 Tcl/Tk 中定义的窗口管理器工具包。
若要运行窗口管理器属性,请将命令 'wm' 与其他关键字一起使用。可以使用 wm_title("title") 或 title("title") 方法来配置窗口的标题。
示例
# Import the required libraries
from tkinter import *
# Create an instance of tkinter frame or window
win=Tk()
# Set the size of the window
win.geometry("700x350")
# Change the title of the window
win.wm_title("My Window")
Label(win, text="Hello, Welcome to Tutorialspoint...", font=('Calibri 24')).pack()
win.mainloop()输出
如果我们运行上述代码,则将显示一个标题为“我的窗口”的窗口。

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP