Tkinter Text Tags Select/User highlight Colour

python, tkinter

Solution

Tags have a priority. What is happening is that your tag has a higher priority than the selection. If you lower the priority of your tag, or raise the priority of the `sel` tag, the selection will be more visible.

Try this:

self.text.tag_raise("sel")

Problem

I am using tags in my Tkinter Text widget yet on certain lines the background colour is changed to a light grey/blue however when a user highlights these lines the colour is not noticeable between the text and whether it has been highlighted or not. Is there an option I can add to my tag configure method call to change the highlight colour? Currently it looks like: ``` self.text.tag_config("oddLine", background="#F3F6FA") ``` Here is a screenshot of how it looks before a user highlights the text: And after is hard to notice that the user has highlighted the middle line: How can I get the colour of what the user selects to be more consistent so that lines that have the background similar to the highlighting colour look similar.

Original source