Highlight text between first and last indices. Text is highlighted via the 'hit' tag and the marked section is brought into view. The colors from the 'hit' tag aren't currently shown when the text is displayed. This is due to the 'sel' tag being added first
(self, first, last)
| 228 | return True |
| 229 | |
| 230 | def show_hit(self, first, last): |
| 231 | """Highlight text between first and last indices. |
| 232 | |
| 233 | Text is highlighted via the 'hit' tag and the marked |
| 234 | section is brought into view. |
| 235 | |
| 236 | The colors from the 'hit' tag aren't currently shown |
| 237 | when the text is displayed. This is due to the 'sel' |
| 238 | tag being added first, so the colors in the 'sel' |
| 239 | config are seen instead of the colors for 'hit'. |
| 240 | """ |
| 241 | text = self.text |
| 242 | text.mark_set("insert", first) |
| 243 | text.tag_remove("sel", "1.0", "end") |
| 244 | text.tag_add("sel", first, last) |
| 245 | text.tag_remove("hit", "1.0", "end") |
| 246 | if first == last: |
| 247 | text.tag_add("hit", first) |
| 248 | else: |
| 249 | text.tag_add("hit", first, last) |
| 250 | text.see("insert") |
| 251 | text.update_idletasks() |
| 252 | |
| 253 | def close(self, event=None): |
| 254 | "Close the dialog and remove hit tags." |
no test coverage detected