[pygtk] Updating scrolled windows

Brian dol-sen at telus.net
Fri Jun 23 10:28:20 WST 2006


On Thu, 2006-06-22 at 17:09 -0700, N. French wrote:
> I have a gtk.ScrolledWindow that I use as an interactive console (I
> take entry from a gtk.Entry and display the results in a gtk.TextView
> housed in a gtk.ScrolledWindow).  Below is my function to write the
> text to the buffer and set the ScrolledWindow's scroll bar to the end. 
> I want it to behave like an xterm would, new text appears at the bottom
> and you scroll upwards to see old stuff.  
> 
> This basically works.  My problem is it doesn't quite scroll the window
> all the way to the bottom, it's always short by one line.
> 
> Any suggestions?
> 
> Thanks,
> 
> Nathan French
> 

Yeah, it doesn't always work unless you make a mark at the end of the
buffer.  Set the property so that any text inserted will be to the left
of the mark.  Then scroll_to_mark.  That will scroll the text onscreen
every time.

-- 
Brian <dol-sen at telus.net>



More information about the pygtk mailing list