- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to change text cursor color in Tkinter?
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.
Advertisements