Hi, I am trying to scroll a textview, and it works except when I
initially set  the buffer from a text file.

Here is what I am doing:

def open_log(self,name):
        self.logfile = file(name,'a+')
        self.end_iter = self.buffer.get_end_iter()
        self.buffer.insert(self.end_iter, file(name,'r').read())
        self.v_scroll.changed()
        self.write("\n\n=============NEW SESSION STARTED=============\n")
        self.write("opened by: %s \n" % user.name)
        self.write("time is: %s\n" % time.strftime("%a, %d %b %Y %H:%M:%S
+0000", time.gmtime()))
        
        
def write(self, string):
        self.logfile.write(string)
        self.logfile.flush()
        self.buffer.insert(self.end_iter, string)
        self.v_scroll.set_value(self.v_scroll.upper)
        self.v_scroll.value_changed()


Now, when up and running, I can scroll the text view by the scroll bar,
and when I call write("somestuff") it is  automatically scrolled to the
bottom to show the next text.

But, when I initially do open_log("somefile") it is only scrolled half
way don the text, untill I call write() again.

Obviously I am doing something wrong but am not sure what it is.

 


-- 

*  Rob Brown-Bayliss
*  =================    
*      zoism.org
_______________________________________________
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