CSS inheritance

This commit is contained in:
Will McGugan
2022-06-02 17:20:03 +01:00
parent 57dec90cc4
commit 39dde3c3cb
13 changed files with 160 additions and 91 deletions

View File

@@ -3,16 +3,18 @@ from textual.widgets import Button
class ButtonApp(App):
CSS = """
Button {
width: 100%;
}
"""
def compose(self):
yield Button("Light", id="light")
yield Button("Dark", id="dark")
yield Button("Lights off")
def handle_pressed(self, event):
self.dark = event.button.id == "dark"
self.dark = not self.dark
event.button.label = "Lights ON" if self.dark else "Lights OFF"