title: Brython wait for image to load, ajax call, or other async functions to complete before continuing execution
body: <p>How can Brython wait for an image to load similarly to how Jquery/Javascript does before proceeding with execution?</p>
  <p>In the above Brython code errors list is never appended to because <code>img.bind('load', on_load)</code> does not block execution. How can I block execution before proceeding?</p>
  <p>Feel free offer up suggestions or an alternative approach to dealing with waits/blocking in Brython.</p>
  <pre><code>error = []
  img = html.IMG(src=blob)
  document &lt;= img
  def on_load(event):
     if img.height*img.width &gt; 2:
         errors.append(f&quot;Image dimensions are too large.&quot;)
         print(errors) # The above error does indeed exist in errors.
  img.bind('load', on_load)
  if errors:
      print(errors) # errors is empty because this was declared as img.bind was running
  </code></pre>