unified events and messages

This commit is contained in:
Will McGugan
2022-08-10 13:09:38 +01:00
parent d6079deb90
commit b3eb543e38
23 changed files with 137 additions and 230 deletions

View File

@@ -5,17 +5,15 @@ from textual.widgets import Button
class ButtonApp(App):
CSS = """
Button {
width: 100%;
}
"""
def compose(self):
yield Button("Lights off")
def handle_pressed(self, event):
def on_button_pressed(self, event):
self.dark = not self.dark
self.bell()
event.button.label = "Lights ON" if self.dark else "Lights OFF"