O'Reilly logo

Tkinter GUI Programming by Example by David Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Searching text

When we need to find a specific piece of text within a Text widget, there is a method called search which will allow us to do this easily.

The search method can take quite a lot of arguments:

  • pattern: The pattern to match. This can be either an exact match or a regular expression.
  • index: Where to begin the search from.
  • stopindex: Where to stop ending a search. If this is not specified, the search will loop.
  • forwards: Whether to search from the top to the bottom (this is the default).
  • backwards: Whether to search from bottom to top.
  • exact: Exact match instead of a regular expression (this is the default).
  • regexp: Indicates that the pattern supplied is a regular expression.
  • nocase: Whether to ignore case.
  • count: A variable which ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required