def terminate(self): self._running = False Gdk.threads_enter() self._prompt.destroy() Gdk.threads_leave() Gtk.main_quit();