Function doesn't highlight a pattern in tkinter text widget Function doesn't highlight a pattern in tkinter text widget tkinter tkinter

Function doesn't highlight a pattern in tkinter text widget


Every time you search, you search from "1.0" to the end of the document. If what you're searching for is in the document even once, this while loop will never end because index will never be an empty string.

The solution is to do start="1.0" before the loop, and then modify your search to start at start since you're updating this variable at the end of your loop.

start = "1.0"while True:    index = xml.search(fi.get(), start, END)