Next, let's code the Find Text feature (2.05.py). The following screenshot shows an example of the Find Text feature:
Here's a quick summary of the desired functionality. When a user clicks on the Find menu item, a new Toplevel window opens up. The user enters a search keyword and specifies whether the search needs to be case-sensitive. When the user clicks on the Find All button, all matches are highlighted.
To search through the document, we rely on the text_widget.search() method. The search method takes in the following arguments:
search(pattern, startindex, stopindex=None, forwards=None, backwards=None, ...