def wait(self): self.condition.acquire() try: while Gtk.events_pending(): GLib.idle_add(self._wake_up) self.condition.wait() finally: self.condition.release()