Add the widget reference for Checkbox

This commit is contained in:
Dave Pearson
2023-02-23 14:26:11 +00:00
parent 66af586d0e
commit 3fd3d272ce
4 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
Screen {
align: center middle;
}
Vertical {
width: auto;
height: auto;
border: solid $boost;
background: $panel;
padding: 2;
}

View File

@@ -0,0 +1,26 @@
from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Checkbox
class CheckboxApp(App[None]):
CSS_PATH = "checkbox.css"
def compose(self) -> ComposeResult:
yield Vertical(
Checkbox("Arrakis :sweat:"),
Checkbox("Caladan"),
Checkbox("Chusuk"),
Checkbox("[b]Giedi Prime[/b]"),
Checkbox("[magenta]Ginaz[/]"),
Checkbox("Grumman", True),
Checkbox("Kaitain", id="initial_focus"),
Checkbox("Novebruns", True),
)
def on_mount(self):
self.query_one("#initial_focus", Checkbox).focus()
if __name__ == "__main__":
CheckboxApp().run()