title: Gtk widget shows up with delay
body: <p>Using python3 and gi.repository, I want to have a Gtk.HeaderBar with a Gtk.Button that is replaced by a Gtk.Spinner as soon as you click on it. After a calculation the button should appear again.</p>
  
  <p>Here is an example of how I think it should work but the Gtk.Spinner only shows up <strong>after</strong> the calculation (in this example sleep) for a very short time. How can I achieve that the spinner shows up for the whole calculation (or sleep)?</p>
  
  <pre><code>from gi.repository import Gtk
  import time
  
  class window:
      def __init__(self):
          self.w = Gtk.Window()
          self.button = Gtk.Button('x')
          self.button.connect('clicked', self.on_button_clicked)
          self.spinner = Gtk.Spinner()
          self.hb = Gtk.HeaderBar()
          self.hb.props.show_close_button = True
          self.hb.pack_start(self.button)
          self.w.set_titlebar(self.hb)
          self.w.connect('delete-event', Gtk.main_quit)
          self.w.show_all()
  
      def on_button_clicked(self, widget):
          self.button.hide()
          self.hb.pack_start(self.spinner)
          self.spinner.show()
          self.spinner.start()
          time.sleep(5)
          self.spinner.stop()
          self.hb.remove(self.spinner)
          self.button.show()
  
  if __name__ == '__main__':
      w = window()
      Gtk.main()
  </code></pre>