Skip to content

Commit

Permalink
chore(toga): complite 4 step of tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
svmikurov committed Aug 28, 2024
1 parent 67bd986 commit 6f471c5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions wselfedu/src/wselfedu/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
from toga.style.pack import COLUMN, ROW


def greeting(name):
if name:
return f"Hello, {name}"
else:
return "Hello, stranger"


class WebSelfEducation(toga.App):
"""Web self education application class."""

Expand Down Expand Up @@ -35,8 +42,10 @@ def startup(self):
self.main_window.show()

def say_hello(self, widget):
print(f"Hello, {self.name_input.value}")

self.main_window.info_dialog(
greeting(self.name_input.value),
"Hi there!",
)

def main():
return WebSelfEducation()

0 comments on commit 6f471c5

Please sign in to comment.