i have a requirement where my execution will happen in threads and i want to
emit signal from that thread to main class. below is my example code snippet,
where i created the an instance of MainClass and assigned it to temp. where
MainClass internally is connected to a thread Thread1 where the actual work
will happen. when the signal is emitted from Thread1 i want the signalcalled
definition to be executed which is connected from temp
Code snippet
class Thread1(QtCore.QThread):
ThreadSignal = QtCore.pyqtSignal(str)
While True:
#some statments
if Condition:
ThreadSignal.emit('Yes')
else:
ThreadSignal.emit('No')
class MainClass(QtCore.QObject):
MainSignal = QtCore.pyqtSignal(str)
Testinstance = Thread1()
def signalcalled(s):
print s
if __name__=='__main__':
app = AtGui.QApplication(sys.argv)
temp = MainClass()
temp.MainSignal.connect(signalcalled)
sys.exit(app.exec()_)
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].