diff --git a/prompt_window.py b/prompt_window.py index 3cb3ac6..fda9d3a 100644 --- a/prompt_window.py +++ b/prompt_window.py @@ -15,19 +15,30 @@ class PromptWindow(Gtk.Window): self.set_size_request(500, 100) self.set_border_width(10) + vbox = Gtk.Box(spacing=10) + self.add(vbox) + self.entry = Gtk.Entry() self.entry.set_text(task) - self.entry.connect("activate", self.save) - self.add(self.entry) + vbox.pack_start(self.entry, True, True, 0) + + hbox = Gtk.Box(spacing=6) + + self.button_ok = Gtk.Button.new_with_label("OK") + self.button_ok.connect("clicked", self.save) + hbox.pack_start(self.button_ok, True, True, 0) + + vbox.pack_start(hbox, True, True, 0) # self.set_title("Entry") - self.connect("destroy", Gtk.main_quit) - def save(self, entry): - task = entry.get_text() + 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. + task = self.entry.get_text() print(task) # A little concerned this might be sort of the nuclear option here. Gtk.main_quit()