Tkinter Text widget incremental search

Bob Greschke bob at passcal.nmt.edu
Thu Sep 28 17:54:29 EDT 2006


I want to create a search function on a Text() widget full of text like the 
incremental search in emacs -- if you type an "f" emacs goes to the first 
"f", type another "f" and it goes to the first place where "ff" shows up in 
the text, etc.

How would you search the text of the Text() for a string like "ff" and get 
back the proper index position (line.char) AND have that take into account 
word wrapping?  Text().get(0.0, END).split("\n") returns a bunch of lines, 
but one line in the List may be many text widget/screen lines.

Thanks!

Bob





More information about the Python-list mailing list