I'm currently having issues with the following code (python 3.4.3 using PyQt5) :
while not joblist ==[]:
currentitem = joblist.pop()
self.lstthreads.item(threadnum-1).setText("thread" + str(threadnum) + " - " + str(len(joblist)) + " items left to process.")
This snippet is inside a thread I first load a huge textfile into a list then split it into 5 parts. Each part runs in the thread above. As you can see a item will be removed each loop using pop() and a listbox (pyqt) is updated with the total amount of items left in the list after pop() for tracking progress.
However the listbox shows: Thread1 - 0 items left to process. Thread2 - 0 items left to process. Thread3 - 0 items left to process. Thread4 - 0 items left to process. Thread5 - 0 items left to process.
The weird thing however is that if I add a print statement like so:
while not joblist ==[]:
print ("trash")
currentitem = joblist.pop()
self.lstthreads.item(threadnum-1).setText("thread" + str(threadnum) + " - " + str(len(joblist)) + " items left to process.")
I get what I expected: Thread1 - 1396 items left to process. Thread2 - 1396 items left to process. Thread3 - 1396 items left to process. Thread4 - 1396 items left to process. Thread5 - 1396 items left to process.
The Listbox items also update as expected , why is this?