I don\'t quite understand how text.search method works.
For example there is a sentence: Today a red car appeared in the park. I need to find a red car
It may be a problem of the indexes.
In a program of mine, i have to search the start index and calculate the end index
my method for example, it works fine:
def highlight(self):
start = 1.0
pos = self.area_example.search(self.item.name, start, stopindex=END)
while pos:
length = len(self.item.name)
row, col = pos.split('.')
end = int(col) + length
end = row + '.' + str(end)
self.area_example.tag_add('highlight', pos, end)
start = end
pos = self.area_example.search(self.item.name, start, stopindex=END)
self.area_example.tag_config('highlight', background='white', foreground='red')