เริ่มแรก Tkinter จะสร้างหน้าต่างที่ปรับขนาดได้สำหรับทุกแอปพลิเคชัน สมมติว่าเราต้องการสร้างหน้าต่างที่ไม่สามารถปรับขนาดได้ในแอปพลิเคชัน ในกรณีนี้ เราสามารถใช้ resizable(height, width) และส่งผ่านค่าของ height=None และ ความกว้าง=ไม่มี . วิธีการนี้ยังทำงานโดยส่งค่าบูลีนเป็น ปรับขนาดได้(เท็จ, เท็จ) .
ตัวอย่าง
#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() ผลลัพธ์
การเรียกใช้โค้ดด้านบนจะแสดงหน้าต่างที่ไม่สามารถปรับขนาดได้
