mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
unified events and messages
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user