ภาพรวม
Tkinter แสดงหน้าต่างแอปด้วย Default Size แต่สามารถแสดง Full-screen ด้วยเมธอด attributes('-fullscreen', True) เมธอดนี้ใช้กำหนด Property ของ Tkinter Window เช่น transparentcolor, alpha, disabled, fullscreen, toolwindow, topmost
ตัวอย่างโค้ด
# Import the tkinter library
from tkinter import *
# Create an instance of tkinter frame
win = Tk()
# Set the geometry
win.geometry("650x250")
# Add a text label and add the font property to it
label = Label(win, text="Hello World!", font=('Times New Roman bold', 20))
label.pack(padx=10, pady=10)
# Create a fullscreen window
win.attributes('-fullscreen', True)
win.mainloop()
ผลลัพธ์
รันโค้ดจะแสดงหน้าต่าง Full-screen ปิดได้ด้วย Alt+F4
