How to change the mouse pointer color in Tkinter?


Tkinter is a standard Python library for developing GUI-based applications. We can change the properties of its widgets by using the built-in functions and methods. In some applications, the properties affect the mouse pointer as well.

Tkinter provides us a way to change the mouse pointer color in the window. To configure the mouse pointer color, we can specify the cursor value with (cursor type and its color). For example, to change the cursor color in a label widget, we can specify the value as, cursor="plus #aab1212" where "plus" defines the cursor type and #aab1212 is the Hex value of the color.


# Import the required libraries
from tkinter import *

# Create an instance of tkinter frame or window

# Set the size of the window

# Add bottom widget
label=Label(win, text="label cursor", cursor="plus red", font=('calibri 18'))

Button(win, text="Button cursor",cursor="dot blue").pack()



If we run the above code, it will display a window with a label widget and a button. Hovering on the widget will change the cursor property.

Published on 05-Aug-2021 14:40:53