I've been trying to get a button check on my Tkinter GUI to search entered text into a text widget for a specific word and make it appear red, I've managed to do that using the following code:
list_of_words = ["foo", "bar`enter code here`"]
def check():
global counter
text.tag_remove('found', '1.0', END)
idx = '1.0'
x = 0
while True:
idx = text.search(list_of_words[x], idx, nocase=1, stopindex=END)
if not idx: break
lastidx = '%s+%dc' % (idx, len(list_of_words[x]))
text.tag_add('found', idx, lastidx)
idx = lastidx
text.tag_config('found', foreground='red')
counter += 1
print counter
However I need to be able to search the input for all words on the list_of_words list and display them all red. Is there any way of doing this?