- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 to hide or disable the mouse pointer in Tkinter?
There are several ways to disable and enable a particular widget in a Tkinter application. However, if we want to control the Tkinter window components such as mouse cursor, control icons, toolbars, then Tkinter provides several built-in functions which can be used to configure the Tkinter window objects.
To hide or disable the mouse pointer for a particular Tkinter application, then we can configure the mouse property using config(mouse= "none") method. It can be invoked for the master or root window.
#Import tkinter library from tkinter import * from tkinter import ttk #Create an instance of Tkinter frame or window win= Tk() #Set the geometry of tkinter frame win.geometry("750x250") def callback(event): win.destroy() #Create a Label and a Button widget label=ttk.Label(win, text="Press Enter to Close the Window", font=('Century 17 bold')) label.pack(ipadx=10) win.bind('<Return>',callback) #Disable the Mouse Pointer win.config(cursor="none") win.mainloop()
Running the above code will hide or disable the Mouse Pointer for the window.
Now, while residing in the window, press Enter that will force the window to close.
- How to change the mouse pointer color in Tkinter?
- Disable Exit (or [ X ]) in Tkinter Window
- Changing the Mouse Cursor in Tkinter
- How to disable a Combobox in Tkinter?
- Moving mouse pointer to a specific location or element using C# and Selenium
- How to show and hide widgets in Tkinter?
- Mouse Position in Python Tkinter
- How to disable checkbutton Tkinter (grey out)?
- How to Disable / Enable a Button in TKinter?
- How to disable multiselection on Treeview in tkinter?
- How to disable an Entry widget in Tkinter?
- How to move a Tkinter canvas with Mouse?
- Binding mouse double click in Tkinter