parameters: (self, func, *args, **kwargs)
docstring: Enqueue task, wait for completion and return result. Can run in any
          thread.
docstring_summary: Enqueue task, wait for completion and return result. Can run in any
          thread.
docstring_tokens: Enqueue task wait for completion and return result . Can run in any thread .
function: def run_sync(self, func, *args, **kwargs):
          """Enqueue task, wait for completion and return result. Can run in any
          thread.
          """
          if not self._started:
              raise RuntimeError("GUI thread has exited.")
  
          with self._lock:
              task = _AsyncEventLoop._Task(func, *args, **kwargs)
              self._run_queue.append(task)
  
          while True:
              with self._cv:
                  self._cv.wait_for(lambda: task.task_id in self._return_vals)
              with self._lock:
                  return self._return_vals.pop(task.task_id)
function_tokens: def run_sync ( self , func , * args , * * kwargs ) : if not self . _started : raise RuntimeError ( "GUI thread has exited." ) with self . _lock : task = _AsyncEventLoop . _Task ( func , * args , * * kwargs ) self . _run_queue . append ( task ) while True : with self . _cv : self . _cv . wait_for ( lambda : task . task_id in self . _return_vals ) with self . _lock : return self . _return_vals . pop ( task . task_id )