Window Manager เป็นชุดเครื่องมือที่มีอยู่ใน Tcl/Tk ซึ่งสามารถเข้าถึงได้ด้วยคำสั่ง 'wm' . 'wm' คำสั่งช่วยให้คุณสามารถกำหนดลักษณะที่ปรากฏและเรขาคณิตของหน้าต่าง Tkinter เราสามารถควบคุมชื่อเรื่อง สี ขนาด และคุณลักษณะอื่นๆ ด้วยคำสั่งนี้ 'wm' คำสั่งมีคีย์เวิร์ดมากมายที่สามารถใช้เพื่อแก้ไขคุณสมบัติของมันได้
ตัวอย่าง
# Import the required library
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
# Create an instance of tkinter frame
win=Tk()
# Set the geometry
win.geometry("700x350")
Label(win, text="This window is disabled.",
font=("Calibri, 24")).pack()
# Makes the window topmost
win.wm_attributes('-topmost', True)
# Makes the window transparent
win.wm_attributes('-alpha', 0.9)
# Disable the window
win.wm_attributes('-disabled', True)
# Set the geometry of the window
win.wm_geometry('700x350')
win.mainloop() ผลลัพธ์
หากคุณเรียกใช้โค้ดข้างต้น โค้ดจะแสดงหน้าต่างโปร่งใสด้านบนสุดซึ่งคุณไม่สามารถโต้ตอบได้ เนื่องจากหน้าต่างถูกปิดใช้งานโดยใช้ wm แอตทริบิวต์ "-disabled" .
