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.
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()
Now, write something in the text field to see the reflected color of the cursor.