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 = 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 = 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 = buffer
        self.iter = self.buffer.get_end_iter()
        self.textview = 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
_______________________________________________
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