[Tkinter-discuss] Where am I in a scrolled Text()?

Bob Greschke bob at passcal.nmt.edu
Wed Feb 27 23:22:16 CET 2013


I have a Toplevel, with a Text() widget and a Scrollbar() attached to its yview.  If I fill it up with a bunch of text, and the user scrolls down to the middle how do I get an index position of a line that is visible?  Like I can .see("100.0") and get to line 100, but how do I find out which line(s) is currently visible?

I have a search function that highlights what the user wants to look for, but then it just jumps up to the first line with a search match with .see().  What I want to do is have it jump to the nearest line with a match in it, instead of all the way to the top of the text, but I don't know how to find out which lines are currently visible.  There isn't a CURSOR or INSERT point to look for.  This is like a Help display just for reading.

Thanks!

Bob



More information about the Tkinter-discuss mailing list