On Sun, 2003-09-07 at 18:44, Martin Preishuber wrote:
> Hi all,
> 
> I tried to solve the following small problem for the 3rd time now and
> didn't find a solution, so I thought I'd ask here :) The problem is the
> following:
> 
> I have a ScrolledWindow containing a TextView widget with a TextBuffer.
> I insert text into the TextBuffer with .insert_at_cursor(text). Now that
> works fine, except that the visible lines are always the first few
> lines, so it doesn't scroll down automatically. 
> How do I automatically scroll down to the latest line ? I played around
> with TextView.place_cursor_on_screen(), scroll_iter() and co but with no
> success :( Any ideas ?

The next C code inserts text at the end and then scrolls down to the
end.

gtk_text_buffer_get_end_iter(buffer, &end_iter);
gtk_text_buffer_insert(buffer, &end_iter, line->str, line->len);
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview),
gtk_text_buffer_get_insert(buffer), 0.0, TRUE, 0.5, 0.5);

So, in python you could do probably something like :

textbuffer.scroll_to_mark(textbuffer.get_insert(), 0);

Too lazy to look up ;-). Hope it helps.

> Thanks,
> 
> Martin

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to