Here is what I want to do. A user enters a search query "hello world". The text is searched for this query, when the sentence with "hello world" is found it is inserted in Text widget and shown to the user.
I want to somehow highlight the words from the search query so they would look like this:
How can I do it?
The text widget allows you to associate tags with a block of text. You do this with the tag_add
method of a text widget object. You can then associate various attributes to a tag, such as a bold font, colors, underlining, etc. You configure the attributes of a tag with the tag_configure
method of the text widget object.