[pygtk] Textview to Tail a log file
Aravind Vijayakumar
iamfenris at yahoo.com
Sun Dec 2 21:44:59 WST 2007
Hi Mark,
Not sure why your code doesn't work, here is my recipe that works for me:
def send(text_view,message):
"""
Inputs : Text view to send to, message to add to the end of the current text
Notes : message may be a list of strings.
"""
buf = text_view.get_buffer()
if type(message) == str:
buf.insert(buf.get_end_iter(),message)
text_view.scroll_to_iter(buf.get_end_iter(),0)
elif type(message) == list:
for msg in message:
buf.insert(buf.get_end_iter(),msg)
text_view.scroll_to_iter(buf.get_end_iter(),0)
Regards,
-Aravind
----- Original Message ----
From: Mark Stahler <isignupnow at gmail.com>
To: pygtk at daa.com.au
Sent: Sunday, December 2, 2007 10:19:19 AM
Subject: [pygtk] Textview to Tail a log file
Hi,
I am new to GTK+ so please go easy on me. I am puzzled as to why my
simple function is not working:
def refreshLog(self):
file = open('log.txt')
string = file.read()
textview = self.gui.get_widget("bottom_textview")
textbuffer = textview.get_buffer()
textbuffer.set_text(string)
iter = textbuffer.get_end_iter()
iter.forward_to_end()
print iter.is_end()
print textview.scroll_to_iter(iter, 0, True)
is_end returns true so I know my iterator is at the end of the text
file
yep scroll_to_iter returns false and does not scroll at all. What is
wrong? Could it be something in my glade file? The rest of the gui
works. Thanks
Mark
_______________________________________________
pygtk mailing list pygtk at daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/
More information about the pygtk
mailing list