I have Python GUI, and in one for-loop I call function from some dll which returns values for populating tableWidget row by row. All this works fine, except I can't scroll table while it's still populating (while dll function calculating things - 7-8secs for each row) so I tried work with threads like this:
q = Queue.Queue()
for i in (0, numberOfRows):
threading.Thread(target=self.callFunctionFromDLL, args=(arg1,arg2, q)).start()
result = q.get()
... do something with "result" and populate table row....
def callFunctionFromDLL(self, arg1, arg2, q):
result = self.dll.functionFromDLL(arg1, arg2)
q.put(result)
but still GUI is not responding until result is passed from q.get (functionFromDLL works 7-8 secs, and than for a moment while GUI populating row I can scroll table). I didn't really worked with threads before, so any suggestion or example how to do this would be appreciated.
I've also tried this way, same thing, gui still not responding while functionFromDLL works:
for i in (0, numberOfRows):
t = threading.Thread(target=self.callFunctionFromDLL, args=(arg1,arg2))
t.start()
t.join()
result = self.result
... do something with "result" and populate table row....
def callFunctionFromDLL(self, arg1, arg2):
self.result = self.dll.functionFromDLL(arg1, arg2)