如何让 Tkinter 窗口无法调整大小?
Tkinter 初始为每个应用程序创建可调整大小的窗口。假设我们希望在应用程序中创建一个不可调大小的窗口。在这种情况下,我们可以使用resizable(高度,宽度) 并传递 height=None 和 width=None 的值。该方法也可以通过传递布尔值 resizable(False, False) 来工作。
示例
#Import the required libraries
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Set the geometry of frame
win.geometry("600x250")
#Set the resizable property False
win.resizable(False, False)
#Create a label for the window or frame
Label(win, text="Hello World!", font=('Helvetica bold',20),
anchor="center").pack(pady=20)
win.mainloop()输出
运行以上代码将显示一个不可调大小的窗口。

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