Prerequisite: Python GUI – tkinter
Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python.
In this article, we will learn, how to change the mouse cursor in Tkinter Using Python.
- A mouse cursor is treated as an indicator, which is used to show the current position of the user position on a computer. It is also called a pointer.
- Every mouse cursor has its own use. For example, for dragging the image we use fleur mouse cursor, for rotating the text we use exchange mouse cursor etc.
There are about 20 cursors that can be found in Tkinter:
Step1: Create Normal Tkinter window and add Button
Step2: Add cursor in button
For adding a cursor in Button, use cursor attributes.
Button(root,text="Button",font=("Helvetica 15 bold"),cursor="star").pack()
Use all cursors
- Make a list, which contains all cursors
- Iterate through all cursors.
Below is the GUI looks like:-
Below is the implementation:
For making the cursor globally, use config() method.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course