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:
parent
596bf7e6a0
commit
9a8be46f8a
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue