I have written a program, that loops through some given files (movie files actually), searches for subtitle for that file, and downloads it. It's a wxPython GUI application. Now, each time a subtitle is downloaded, I want to update the ListControl of the GUI with some text. The code is below:
for i in range(total_items):
path = self.list.GetItem(i, 0) # gets the item (first column) from list control
path = path.GetText() # contains the path of the movie file
t = Thread(target = self.Downloader, args = (path,))
t.start()
t.join() # using this hangs the GUI and it can't be updated
self.list.SetItem(i, 1, 'OK') # update the listcontrol for each download
It is obvious that I want to update the GUI only when the thread finishes. I used t.join(), but later understood that it cannot be used to update GUI's, as stated in this question: GObject.idle_add(), thread.join() and my program hangs
Now, I want to use something similar as stated in that question, but I can't figure anything out as I am using wxPython.