title: Python, Multiprocessing and GUI
body: <p>I have a program with a GUI that needs to do some multiprocessing. The point of it is to avoid freezing the GUI, and to allow the user using some other buttons while the process is running.</p>
  
  <p>I'd like then to define a method like the following:</p>
  
  <pre><code>def start_waiting(self, parent, func, args):
  
      self.window_waiting.show()
  
      task=Process(func(*args))
      task.start()
  
      task.join()
  
      # Some code to execute at the end of the process
      #
      #...
  </code></pre>
  
  <p>The problem is that <code>join()</code> is not working, and I need it because the code executed after <code>join()</code> indicates when the <code>Process</code> has ended. I'll use that code to update a cancel button of the <code>window_waiting</code>.</p>
  
  <p>I then came in mind with another solution to avoid using<code>join()</code>, I replaced it with:</p>
  
  <pre><code>while task.is_alive():
      time.sleep(0.5)
  </code></pre>
  
  <p>But it didn't worked neither, so I tried a plan C, which was to create a queue:</p>
  
  <pre><code>def worker(input, output):
      for func, args in iter(input.get, 'STOP'):
          result=func(*args)
          output.put(result)
  
  
  task_queue = Queue()
  done_queue = Queue()
  task_queue.put(task)
  
  Process(target=worker, args=(task_queue, done_queue)).start()
  done_queue.get()
  </code></pre>
  
  <p>The last code gave me the error: <code>'Pickling an AuthenticationString object is '
  TypeError: Pickling an AuthenticationString object is disallowed for security reasons</code></p>
  
  <p>Which lead me to <a href="https://stackoverflow.com/questions/17578844/multiprocessing-process-subclass-using-shared-queue">multiprocessing.Process subclass using shared queue</a> but I haven't managed to solve the problem :/</p>