The adjustment for the GtkText widget represents the position in the text.

You can set its value with the set_value() method.  Something like:
  adj = text.get_vadjustment()
  adj.set_value(adj.upper - adj.page_size)

This should adjust where the scrollbar thumb is positioned and the
position in the text.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Tue, 29 Feb 2000 [EMAIL PROTECTED] wrote:

> [ gtk+-1.2.6, pygtk-0.6.4, python-1.5.2 ]
> 
> I create a text widget, and attach a vertical scrollbar.
> I insert a lot of text.  Now I want to programmaticaly position
> the scrollbar at the end, i.e. with the last line of text at the
> visible bottom of the window.  How is this done?
> 
> vbox.pack_start(GtkLabel('Machine Log'), FALSE, FALSE)
> text = GtkText()
> text.set_editable(FALSE)
> text.set_word_wrap(TRUE)
> textbox=GtkHBox()
> textbox.pack_start(text, TRUE, TRUE, 0)
> textbox.pack_start(GtkVScrollbar(text.get_vadjustment()), FALSE, FALSE, 0)
> vbox.pack_start(textbox, TRUE, TRUE)
> 
> text.delete_text(0, -1)
> text.freeze()
> for ldate,lstatus,lusr,lcomment in rslt:
>     text.insert_defaults('Date: ' + ldate + '  User: ' + lusr + '  Status: ' + 
>lstatus + '\n')
>     text.insert_defaults(lcomment + '\n')
>     text.insert_defaults('___________________________\n')
> text.thaw()
> 
> #Now 'text' is positioned at the top; how do I set it to the bottom.
> #I looked for something like set_scroll_pos(pos), but couldn't find such.
> 
> Any other comments about good (or terrible) style, easier/better ways to 
> do things like this are welcome...
> 
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to