How do I use Window Manager (wm) attributes in Tkinter?

The Window Manager is a toolkit available in Tcl/Tk that can be accessed with the command 'wm'. The 'wm' command allows you to set the appearance and geometry of the Tkinter window. We can control the title, color, size, and other attributes with this command. The 'wm' command has numerous keywords that can be used to modify its property.


# Import the required library
from tkinter import *
from tkinter import ttk
from tkinter import messagebox

# Create an instance of tkinter frame

# Set the geometry

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



If you run the above code, it will display a topmost transparent window that you cannot interact with, as the window is disabled using the wm attribute "-disabled".

Updated on: 05-Aug-2021

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started