How to change text cursor color in Tkinter?
Asked Answered
L

3

23

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?

Lemonade answered 11/1, 2013 at 18:32 Comment(0)
C
35

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

Canyon answered 11/1, 2013 at 18:39 Comment(0)
S
17

Option for text cursor color in Tk is -insertbackground.

textWidget.config(insertbackground=...)
Sashasashay answered 11/1, 2013 at 18:39 Comment(2)
Is there any way to change the thickness of the cursor ? Just like the default cursor in Vim?Heck
@Heck Yes: "insertwidth".Banquet
C
3

For python version 3

import tkinter as tk

textfield = tk.Entry(root)
textfield.configure(bg="#1C6C0B", insertbackground='white')
Colonel answered 31/1, 2020 at 2:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.