How to change text cursor color in Tkinter?

前端 未结 3 1720
臣服心动
臣服心动 2021-02-12 12:21

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?

相关标签:
3条回答
  • 2021-02-12 12:45

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

    0 讨论(0)
  • 2021-02-12 12:57

    For python version 3

    import tkinter as tk
    
    textfield = tk.Entry(root)
    textfield.configure(bg="#1C6C0B", insertbackground='white')
    
    0 讨论(0)
  • 2021-02-12 13:07

    Option for text cursor color in Tk is -insertbackground.

    textWidget.config(insertbackground=...)
    
    0 讨论(0)
提交回复
热议问题