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.
This commit is contained in:
mlncn 2021-05-02 12:11:53 -04:00
parent 596bf7e6a0
commit 9a8be46f8a

View file

@ -41,9 +41,11 @@ class PromptWindow(Gtk.Window):
vbox.pack_start(hbox, True, True, 0) vbox.pack_start(hbox, True, True, 0)
# self.set_title("Entry") # self.set_title("Entry")
self.show_all()
Gtk.main()
def save(self, item): def save(self, item):
# Note: item is the entry directly if enter is pressed, but the button # 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. # (i guess) if the button is pressed, so we do not use it.
@ -66,7 +68,5 @@ class PromptWindow(Gtk.Window):
if __name__ == '__main__': if __name__ == '__main__':
win = PromptWindow("I'mma tell you what i'm gonna do.") win = PromptWindow("I'mma tell you what i'm gonna do.")
win.show_all()
Gtk.main()
tha_task = win.retrieve() tha_task = win.retrieve()
print(tha_task) print(tha_task)