From: bbaetz at ug.cs.su.oz.au (Baetz; Bradley Michael)
Date: Fri, 30 Apr 1999 02:19:09 GMT
Subject: Q on Tkinter Scrollbar
Message-ID: <r8FAR29K@ugrad.ug.cs.su.oz.au>
X-UID: 1566                                                  

	you can use the "@x,y" index syntax for this; the
	start of the visible text is "@0,0", the end is "@x,y"
	where x and y is the window size (or anything
	larger, like "@10000,10000").

	also see the attached example.

	....

	def report_position():

	    # get (beginning of) first visible line
	    top = text.index("@0,0")

	    # get (end of) last visible line
	    bottom = text.index("@0,%d" % text.winfo_height())

Thanks a lot for your help. The only thing I don't understand is why the above line returns the position of the _end_ of the line. I know it does (I tried it), but wouldn't the "@0,%d" mean that text.index returns the absolute index to the position where x=0 (ie the beginning of the line), not the end? Now looking at your comments :), I would have got the absolute line number, and then used lineno.end as the index. What did I miss?

Thanks a lot,


Bradley




