By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

can i move attribute values from one class to another?

P: n/a
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?

Sep 7 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
oh wait.
never mind , i figgured it out!
thanks anyway

Sep 7 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.