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