[Tkinter-discuss] Restoring scroll position in a scrolled text window
michael.odonnell at uam.es
Tue Mar 16 18:22:00 CET 2010
Under Windows with python 2.6.4 Tkinter 8.5
I am trying to find a way to restore exactly the same scroll
position in a scrolled text widget, after deleting all text and
re-inserting the same text.
Given a text widget in self.text, I can do the following:
# record the index of the top visible line in the text widget
# redraw the text
# Restore the scroll
However, "see" does not put this line index at the top
of the text widget, but rather some number of lines below
(unless it was already visible, in which case it stays where it was)
Is there an easy way to put a definite line at the top of a scrolled
I would use
...but I cannot find out at what fraction of the window this line is!
(my lines are of variable height, so I cannot simply multiply line height).
Any other ideas?
More information about the Tkinter-discuss