[pygtk] gobject question
shawn bright
nephish at gmail.com
Fri Mar 2 23:33:54 WST 2007
hello there all,
i have a few threads running that write to the same text veiwer.
sometimes when the program is running i get this in the terminal window.
GtkWarning: Invalid text buffer iterator: either the iterator is
uninitialized, or the characters/pixbufs/widgets in the buffer have
been modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a
position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents
that can be referred to by character offset)
will invalidate all outstanding iterators
this is the function i use to write data to the viewer
def write_to_viewer(data, buffer, viewer):
data = '%s\n' % data
buffer.insert(buffer.get_end_iter(), data)
if buffer.get_line_count() > 1000:
buffer.delete(buffer.get_start_iter(), buffer.get_iter_at_line(200))
mark = buffer.create_mark("end", buffer.get_end_iter(), False)
viewer.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
then in each thread i have
write_to_viewer(self, data, self.main_buffer, self.main_view)
and it gets called like this
gobject.idle_add(self.write_to_viewer, data)
anything i can do to clear that error ? or is it no big deal ?
thanks
sk
More information about the pygtk
mailing list