Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
💄 Tweak the notification test app some more
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Jun 27, 2023
1 parent 21db230 commit f275b62
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions notification_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ def compose(self) -> ComposeResult:
yield Rack()
with Grid():
for n in range(25):
yield Button(f"Notification {n}", id=f"b{n}")
yield Button("Press for a \nnotification")

@on(Button.Pressed)
def show_toast(self, event: Button.Pressed) -> None:
self.query_one(Rack).add_toast(f"This is {self.notification}")
level = ["information", "warning", "error"][self.notification % 3]
self.query_one(Rack).add_toast(f"This is test notification {self.notification}", level=level)
self.notification += 1

if __name__ == "__main__":
Expand Down

0 comments on commit f275b62

Please sign in to comment.