Highlight the text at runtime in tkinter python

How to Highlight Text in Tkinter | Tkinter Text Widget Example | Tkinter GUI Tutorial.

*Video Link:-
https://youtu.be/XETQYNnaKME

*Details:- In this program, we highlight text at Runtime. First we select the text then create a tag for the selected text. Next change the background and foreground colour of that tag-selected text.

*Coding:-

def highlight(text):

try:

s=text.index("sel.first")

l=text.index("sel.last")

text.tag_add("sel_txt", s, l)

text.tag_config('sel_txt', background='yellow', foreground='red')

except tk.TclError:

pass

*Tags:-
#python #tkinter #text #textarea #widget #online #learning #tutorial #india #coding #programming #computercodingclass

Computer Coding Class
Computer Coding Class

Written by Computer Coding Class

It is a YouTube Channel to learn Computer Coding and Programming in different famous Programming languages like C++, Python, Java from scratch to advanced leveI

No responses yet