# How to change text cursor color in Tkinter?

TkinterServer Side ProgrammingProgramming

Tkinter Entry and text widgets are used to create single and multiline text input fields. In order to change the color of the cursor, we can specify the insertbackground property by assigning the color of the cursor.

## Example

In this example, we have created the text field and we have changed the color of the cursor by defining the insertbackground property.

#Import the tkinter library
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
win.geometry("750x250")
#Create a text field
text= Text(win)
text.configure(bg= 'SteelBlue3',insertbackground='red')
text.pack()
win.mainloop()

## Output

Now, write something in the text field to see the reflected color of the cursor.

Published on 15-Apr-2021 14:06:41