mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge branch 'main' of github.com:Textualize/textual into datatable-cell-keys
This commit is contained in:
@@ -7,7 +7,7 @@ Screen {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
Checkbox {
|
||||
Switch {
|
||||
height: auto;
|
||||
width: auto;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ Checkbox {
|
||||
background: darkslategrey;
|
||||
}
|
||||
|
||||
#custom-design > .checkbox--switch {
|
||||
#custom-design > .switch--switch {
|
||||
color: dodgerblue;
|
||||
background: darkslateblue;
|
||||
}
|
||||
@@ -1,35 +1,35 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Horizontal
|
||||
from textual.widgets import Checkbox, Static
|
||||
from textual.widgets import Switch, Static
|
||||
|
||||
|
||||
class CheckboxApp(App):
|
||||
class SwitchApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Static("[b]Example checkboxes\n", classes="label")
|
||||
yield Static("[b]Example switches\n", classes="label")
|
||||
yield Horizontal(
|
||||
Static("off: ", classes="label"),
|
||||
Checkbox(animate=False),
|
||||
Switch(animate=False),
|
||||
classes="container",
|
||||
)
|
||||
yield Horizontal(
|
||||
Static("on: ", classes="label"),
|
||||
Checkbox(value=True),
|
||||
Switch(value=True),
|
||||
classes="container",
|
||||
)
|
||||
|
||||
focused_checkbox = Checkbox()
|
||||
focused_checkbox.focus()
|
||||
focused_switch = Switch()
|
||||
focused_switch.focus()
|
||||
yield Horizontal(
|
||||
Static("focused: ", classes="label"), focused_checkbox, classes="container"
|
||||
Static("focused: ", classes="label"), focused_switch, classes="container"
|
||||
)
|
||||
|
||||
yield Horizontal(
|
||||
Static("custom: ", classes="label"),
|
||||
Checkbox(id="custom-design"),
|
||||
Switch(id="custom-design"),
|
||||
classes="container",
|
||||
)
|
||||
|
||||
|
||||
app = CheckboxApp(css_path="checkbox.css")
|
||||
app = SwitchApp(css_path="switch.css")
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
Reference in New Issue
Block a user