can i move attribute values from one class to another?

N

nephish

heres the deal.
i am working on a threading gui. pygtk
in one class (main) is all the gui stuff,
but in another class that is a thread, i am reading serial input.
what i want to be able to do is take what read in the thread and
print it in a textview in the gui class.

here is what i have:


class Serial1(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)


def run(self):
ser = serial.Serial('/dev/ttyS15', 2400, timeout=None)
loopy = 1
while loopy < 5:
for x in range(5):
Input1Data = 'buncha data and timestamp\n'
gobject.idle_add(self.buffer_add, Input1Data)

def buffer_add(self, Input1Data):
Input1Iter = self.Input1Buffer.get_end_iter()
self.Input1Buffer.insert(Input1Iter, Input1Data)


class Main(SimpleGladeApp):
def __init__(self, path="pivcontrolcenter.glade",
root="Main",
domain=app_name, **kwargs):
path = os.path.join(glade_dir, path)
SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
self.MessageBuffer = self.MessageView.get_buffer()

def on_StartEnginesButton_clicked(self, widget, *args):
Input1Iter = self.MessageBuffer.get_end_iter()
Input1Data = 'Reading Serial device ttyS14 \n'
self.Input1Buffer.insert(Input1Iter, Input1Data)
time.sleep(1)
S1 = Serial1()
S1.start()

basically, i need a way to pass data, actually the control of the
textview wiget
in and out of a class.
is this possible?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,315
Members
48,000
Latest member
SusannahSt

Latest Threads

Top