I have a TextView in a ScrolledWindow, and a process writes output to
it; every time a line is written, it scrolls to the end using
TextView.scroll_to_iter.  However, this means it's hard to scroll up to
view earlier output.

What I want to do is check if the last line is visible before printing a
line, then print the line, then scroll to the end only if the last line
was visible before:

textbuffer = textview.get_buffer()
scroll = [if end is visible]
textbuffer.insert(textbuffer.get_end_iter(), output + '\n')
if scroll:
textview.scroll_to_iter(textbuffer.get_end_iter(), .0)

 - So that it's possible to view stuff earlier on without being scrolled
back to the end all the time, but you can return to auto-scrolling by
scrolling back to the end manually.  I haven't been able found any
functions for TextViews/TextIters/TextMarks in any reference that would
do this.

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to