i am trying to program text editor by using tkinter. this is the mark function:
self.text.tag_add("Mark",tk.SEL_FIRST,tk.SEL_LAST)
self.text.tag_config("Mark",background="yellow",foreground="black")
and this is the unmark function
self.text.tag_add("UnMark",tk.SEL_FIRST,tk.SEL_LAST)
self.text.tag_config("UnMark",background="white",foreground = "black")
but the problem is when i mark the text and then unmark it, i cant mark it again. the mark function dont work when i try to mark the text again that i unmarked it.
The reason is because the "UnMark" tag has a higher priority than the "Mark" tag. You can add the "Mark" tag, but the configuration of "UnMark" takes precedence.
I recommend instead of an "UnMark" tag, you simply remove the "Mark" tag when you don't want something to be marked.