mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add the widget reference for Checkbox
This commit is contained in:
26
docs/examples/widgets/checkbox.py
Normal file
26
docs/examples/widgets/checkbox.py
Normal 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()
|
||||
Reference in New Issue
Block a user