I am currently trying to write a program which adds coloured text to both sides of selected text in Tkinter.
What I have managed to do so far is add text on both sides of selected text, here is the function I use:
def addTerm(self):
self.txt.insert(tk.SEL_FIRST,'\\term{')
self.txt.insert(tk.SEL_LAST,'}' )
So if I have a WORD and I select it, after calling this function it becomes \term{WORD}. I am wondering if there is a way to change the color of the text I am adding, so that when I use the function for the selected text it adds ' \term{ ' and '}' which are, for example, red, but it doesn't change the colour of the text between them.