Hi, I'm using a TextView as a telnet terminal and want to scroll the
view when new output arrives. I use the following code fragment
- snip -
def write(self, text):
a = self.scroll.get_vadjustment()
sc = (a.value >= a.upper - a.page_size)
text = self.ansi.split(text)
while text:
self.output.get_buffer().insert_at_cursor(text[0])
if len(text) > 1:
self.ansi_command(text[1])
text = text[2:]
else:
break
if sc:
self.output.scroll_to_iter(self.output.get_buffer().get_end_iter(),
0.0, False, 0.0, 0.0)
- snip -
That is, if the user has not scrolled the View and output happens, the
new end of buffer is scrolled to be visible. At least I thought so.
But when I try it out, nothing happens, although sc is correctly set to
True. I also tried scroll_to_mark(buffer.get_insert()) with the same
result. Even changing the adjusments value doesn't work since the upper
limit is not updated when the insert function returns. Maybe if there is
a way to make sure the Adjustments upper bound is updated, that would be
the best solution.
I Also encounter the problem that clicking in the TextView sets the
insert mark although the text is neither editable nor the cursor is
shown. Maybe I have to catch the button_pressed signal there?
Thanks for helping.
--
Felix Benner Tel. +49 (0)711 720 7900
Fanny-Leicht-Stra�e 14 Mobil +49 (0)177 339 4145
D-70563 Stuttgart mailto:[EMAIL PROTECTED]
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/