Reading A File Without Block Main Thead In GUI
In my first attempt, I tried, failed, learned, and came back with the following attempt. I have a text file with the names parsed with commas that looks like this: Ann Marie,Smith
Solution 1:
The for
-loop in textfilemanage()
waits until the thread finishes so the different thread is useless in the code.
Instead:
Create the empty combobox in __init__
(needed for layouting) and assign it to self.combo
In textfilemanage()
start the thread but don't wait for it.
In read_employees()
replace the final return
statement by
wx.CallAfter(self.combo.Append, emp_list)
or
wx.CallAfter(self.combo.AppendItems, emp_list)
(it depends on the wxPython version which variant is accepted)
Post a Comment for "Reading A File Without Block Main Thead In GUI"