Perhaps use window coordinates? There's a way of indexing with "@x,y" that might work.
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text-index.html https://www.tcl.tk/man/tcl8.4/TkCmd/text.htm#M20 On Wed, Feb 27, 2013 at 2:22 PM, Bob Greschke <b...@passcal.nmt.edu> wrote: > 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 > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss >
_______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss