'How to change text cursor color in Tkinter?

I have a text widget with dark background and I can't see the cursor's position. Is there any way to change the (blinking) text cursor's color?



Solution 1:[1]

You can change the insertbackground option of the text widget to whatever you want.

Solution 2:[2]

Option for text cursor color in Tk is -insertbackground.

textWidget.config(insertbackground=...)

Solution 3:[3]

For python version 3

import tkinter as tk

textfield = tk.Entry(root)
textfield.configure(bg="#1C6C0B", insertbackground='white')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bryan Oakley
Solution 2 Anton Kovalenko
Solution 3 I Love Coding