diff --git a/src/helloworld/app.py b/src/helloworld/app.py index 9b15d9b..d88b4fe 100644 --- a/src/helloworld/app.py +++ b/src/helloworld/app.py @@ -20,20 +20,36 @@ class HelloWorld(toga.App): name_box.add(name_label) name_box.add(self.name_input) - button = toga.Button( + hello_button = toga.Button( "Say Hello!", on_press=self.say_hello, style=Pack(padding=5) ) + + quit_button = toga.Button( + "Quit", + on_press=self.quit, + style=Pack(padding=5) + ) + main_box.add(name_box) - main_box.add(button) + main_box.add(hello_button) + main_box.add(quit_button) self.main_window = toga.MainWindow(title=self.formal_name) self.main_window.content = main_box self.main_window.show() + def quit(self, widget): + if self.on_exit is not None: + self.on_exit() + self.exit() + def say_hello(self, widget): - print(f"Hello, {self.name_input.value}") + self.main_window.info_dialog( + f"Hello, {self.name_input.value}", + "sup dawg!" + ) def main():