multithreading - Signal from QThread doesn't get emitted -


i tried following solution laid out in this question, nothing seems happen once signal supposed emitted.

this isn't of code, should enough demonstrate i'm trying do:

class startqt5(qmainwindow):     def __init__(self):         super().__init__()         [...]         self.getfileproperties(path, batch)      def getfileproperties(self, path, batch):         self.thread = qthread()         self.w = probethread(self)                 self.w.movetothread(self.thread)         self.w.finished[dict].connect(self.setprobeoutput)         self.thread.started.connect(self.w.run)         self.thread.start()      @pyqtslot(dict)         def setprobeoutput(self, data):         print("gotoutput")         self.probeoutput = data         print(data)  class probethread(qobject):     finished = pyqtsignal(dict)      def __init__(self, parent):         super().__init__()         self.parent = parent         self.output = {}      def run(self):         self.output = json.loads(subprocess.check_output('%s -v 0 -print_format json -show_format -show_streams -count_frames "%s"' % (self.parent.ffprobepath, self.parent.file)).decode("utf-8"))         print("finished")         self.finished.emit(self.output) 

the thread runs fine, setprobeoutput never gets called. sorry if trivial, can't seem work, thanks! :)

what doing:

self.w.finished.connect(self.setprobeoutput) 

you defining new signal , attaching slot, declare parameters types both in signal , slot declaration.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -