Tkinter สร้างหน้าต่างเริ่มต้นด้วยขนาดเริ่มต้นในขณะที่เริ่มต้นแอปพลิเคชัน เราสามารถปรับแต่งรูปทรงของหน้าต่างโดยใช้ เรขาคณิต วิธีการ
อย่างไรก็ตาม เพื่อขยายหน้าต่างให้ใหญ่สุด เราสามารถใช้ state() วิธีที่สามารถใช้สำหรับการปรับขนาดหน้าต่าง tkinter ขยายหน้าต่างให้ใหญ่สุดหลังจากส่งค่าสถานะ "ซูม" ไป
ตัวอย่าง
#Import the required libraries
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Set the geometry of frame
win.geometry("600x400")
#Create a text label
Label(win,text="It takes only 21 days to create a new Habit", font=('Times
New Roman bold',15)).pack(pady=20)
#Maximize the window using state property
win.state('zoomed')
win.mainloop() ผลลัพธ์
การรันโค้ดด้านบนจะเป็นการขยายหน้าต่าง tkinter ให้ใหญ่สุด
