Is there an Application.DoEvents() equivalent in wxPython?
I am creating a form, then doing a slow I/O event, and the form is only partially drawn until the event finishes. I’d like to have the form fully drawn before the I/O starts.
I’ve tried self.Refresh(), but it has no effect.
wx.Yieldorwx.SafeYieldAlthough you should really use a separate thread to do the I/O and use
wx.CallAfterto post updates to the GUI thread.I usually use a pattern like this:
You would call
start_workfrom the GUI, for example on anEVT_BUTTONevent to start the work.do_workis run on a separate thread but it cannot do anything GUI related because that has to be done on the GUI thread. So you usewx.CallAfterto run a function on the GUI thread, and you can pass it arguments from the work thread.