Ярлыки

суббота, 3 ноября 2012 г.

transfer data between threads in PyQt


I create signal in start function (in the other words - "wait for signal"):

self.connect(self.s1,QtCore.SIGNAL('printStat(PyQt_PyObject)'),self.printStat)

s1 - child thread;
printStat(PyQt_PyObject) - signal name, which send from thread s1 to main thread;
self.printStat  - function for our reaction by signal ( self = QMainWindow() ).


I create sending signal in child thread:

self.emit(QtCore.SIGNAL('printStat(PyQt_PyObject)'),[list of transfer vars])

I can transfer any PyQt- or/and Python-objects.

Function printStat must get transfer objects:

    def printStat(self, [list of transfer vars]):

Комментариев нет:

Отправить комментарий