0

Here is the code for a progressbar for a urlretrieve download in wx. I do the download work in a different process. It works, but is a bit laggy and unresponsive. As in I cannot move the window around freely. What could be the problem?

1
  • I am usually told not to use threads nor processes. People always point me to twister and event-driven programming (registering callbacks etc.) Threads and processes are a pain to debug and may have different behaviors on different platforms. Commented Jan 30, 2014 at 8:11

1 Answer 1

2

I'm guessing it's because you're calling this:

self.dloader.parent_conn.recv() 

That is probably a long running process, so it blocks wxPython's main loop, which makes the UI unresponsive. The typical workaround is to send a message back to the UI from the process or thread telling it to update. You will probably need to use one of wxPython's thread-safe methods to be safe:

  • wx.CallAfter
  • wx.CallLater
  • wx.PostEvent

The canonical article on this topic can be found in the wxPython wiki:

There is also a wiki page on MultiProcessing that you might find helpful:

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.