Files
textual/docs/examples/light_dark.py
2022-08-10 13:09:38 +01:00

20 lines
376 B
Python

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