From 9a8be46f8aa987bb20ea721f7fe1992ee265f912 Mon Sep 17 00:00:00 2001 From: mlncn Date: Sun, 2 May 2021 12:11:53 -0400 Subject: [PATCH] Bring triggers to actually show window into main function Well, init function. Point is our calling program shouldn't have to think about windows showing all or GTK main anything! The main trick mentioned last commit wasn't this call to Gtk.main() but rather the if __name__ == '__main__' bit. --- prompt_window.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prompt_window.py b/prompt_window.py index f5b8275..de86a1f 100644 --- a/prompt_window.py +++ b/prompt_window.py @@ -41,9 +41,11 @@ class PromptWindow(Gtk.Window): vbox.pack_start(hbox, True, True, 0) - # self.set_title("Entry") + self.show_all() + Gtk.main() + def save(self, item): # Note: item is the entry directly if enter is pressed, but the button # (i guess) if the button is pressed, so we do not use it. @@ -66,7 +68,5 @@ class PromptWindow(Gtk.Window): if __name__ == '__main__': win = PromptWindow("I'mma tell you what i'm gonna do.") - win.show_all() - Gtk.main() tha_task = win.retrieve() print(tha_task)