Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

วิธีตั้งค่าขนาดหน้าต่างขั้นต่ำใน Tkinter


ภาพรวม

หน้าต่าง Tkinter เริ่มต้นหลังรันแอปพลิเคชัน ความกว้างและสูงปรับได้ สามารถ Minimize ได้ เพื่อตั้งค่าขนาดหน้าต่างขั้นต่ำ กำหนดค่าความกว้างและสูงในเมธอด minsize(height, width) เรียกเมธอดด้วย Object Window หรือ Frame

ตัวอย่างโค้ด

# Import the required libraries
from tkinter import *
# Create an instance of tkinter frame
win = Tk()
# Minimize the window
win.minsize(150, 100)
# Create a text label
Label(win, text="Window Size is minimized to 150x100", font=('Helvetica bold', 20)).pack(pady=20)
win.mainloop()

ผลลัพธ์

รันโค้ดจะตั้งค่าขนาดหน้าต่างขั้นต่ำ

วิธีตั้งค่าขนาดหน้าต่างขั้นต่ำใน Tkinter