[pygtk] question about a updating a textview as an object
shawn bright
nephish at gmail.com
Thu Oct 19 12:50:53 WST 2006
hey there.
i have a gtk GUI app that uses 4 text views to update info from 4 different
threads. the code i use to update the view is this.
def buffer_add(self, input_data, buffer, textview):
self.buffer.insert(self.buffer.get_end_iter(), input_data)
if self.buffer.get_line_count() > 400:
self.buffer.delete(self.buffer.get_start_iter(),
self.buffer.get_iter_at_line(200))
mark =3D self.buffer.create_mark("end",
self.buffer.get_end_iter(), False)
self.textview.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
now, i have the same function in all four threads. Each updates a different
textview.
the threads run in a class threading.thread.
the code that calls them is like this.
S1 =3D Serial1(self.Input1Buffer, self.TTYS14View)
S1.start()
each thread has some initial code like this
class Serial1(threading.Thread):
def __init__(self, buffer, textview):
threading.Thread.__init__(self)
self.buffer =3D buffer
self.iter =3D self.buffer.get_end_iter()
self.textview =3D textview
my question is..... from the main app, if i pass the textview and buffer to
each thread that needs one, can i, from the thread pass those as objects to
one function that will update the text view? if so, do i need to make that
function a global object ? or can i just declare it at the beginning of the
program ?
does this question make sense?
if you have read this far, i thank you for your time.
shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061018/b94675b0/at=
tachment.htm
More information about the pygtk
mailing list