[PyQt] PyQt4 pass an object into a Qthread
hl3fx
dn_v0 at hotmail.com
Mon Feb 8 14:48:06 GMT 2010
I have a DDE driver that is talking to a machine control app running on the
same computer. The problem im having is being able to access the driver
functions through the lifetime of the main app using multiple threads.
So far i have tried passing the object of the driver to the thread class and
importing the driver directly from the thread.
Passing the driver to the class does not work when i call the start()
function.
Importing the driver directly in the thread works fine, although if i abort
the thread i cannot then restart and use the driver. I tried deleting all
the references it had imported but this process seemed a little inefficient,
and i never actually got it working.
So my questions is, is there a way to pass the driver instance into the
qthread like this:
Main App:
import athread
import ddeDriver
at = athread.threadClass()
at.start(ddeDriver)
athread.py:
class threadClass(QtCore.QThread):
def __init__(self, parent = None):
QtCore.QThread.__init__(self, parent)
self.running = True
def run(self, ddeDriver):
ddeDriver.cmd('reset')
while self.running:
if not ddeDriver.query('next'):
break
hopefully what im asking is clear. Just need to be able to pass an object
into a QThread from the main app.
Thanks for any help!!
--
View this message in context: http://old.nabble.com/PyQt4-pass-an-object-into-a-Qthread-tp27495284p27495284.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt
mailing list