mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Button docs, change container utilities
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
Button {
|
||||
margin: 1 2;
|
||||
}
|
||||
|
||||
Horizontal > Vertical {
|
||||
width: 24;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin: 1 0 0 2;
|
||||
text-style: bold;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
from textual import layout
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import Button
|
||||
from textual.widgets import Button, Static
|
||||
|
||||
|
||||
class ButtonsApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Button("Default", id="foo")
|
||||
yield Button("Disabled", disabled=True)
|
||||
yield Button.success("Success!")
|
||||
yield Button.warning("Warning!")
|
||||
yield Button.error("Error!")
|
||||
yield layout.Horizontal(
|
||||
layout.Vertical(
|
||||
Static("Standard Buttons", classes="header"),
|
||||
Button("Default"),
|
||||
Button("Primary!", variant="primary"),
|
||||
Button.success("Success!"),
|
||||
Button.warning("Warning!"),
|
||||
Button.error("Error!"),
|
||||
),
|
||||
layout.Vertical(
|
||||
Static("Disabled Buttons", classes="header"),
|
||||
Button("Default", disabled=True),
|
||||
Button("Primary!", variant="primary", disabled=True),
|
||||
Button.success("Success!", disabled=True),
|
||||
Button.warning("Warning!", disabled=True),
|
||||
Button.error("Error!", disabled=True),
|
||||
),
|
||||
)
|
||||
|
||||
def on_button_pressed(self, _event: Button.Pressed) -> None:
|
||||
self.app.bell()
|
||||
|
||||
Reference in New Issue
Block a user