![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
Example
# 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()
Output
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".
Advertisements