mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
lots more docs
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.layout import Container
|
||||
from textual.widgets import Header, Footer, Static
|
||||
from textual.layout import Container, Horizontal
|
||||
from textual.widgets import Header, Footer, Static, Button
|
||||
|
||||
QUESTION = "Do you want to learn about Textual CSS?"
|
||||
|
||||
|
||||
class ExampleApp(App):
|
||||
@@ -8,9 +10,13 @@ class ExampleApp(App):
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(
|
||||
Static(id="widget1"),
|
||||
Static(id="widget2"),
|
||||
Static(id="widget3"),
|
||||
Static(QUESTION, classes="question"),
|
||||
Horizontal(
|
||||
Button("Yes", variant="success"),
|
||||
Button("No", variant="error"),
|
||||
classes="buttons",
|
||||
),
|
||||
id="dialog",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
/* The top level dialog (a Container) */
|
||||
#dialog {
|
||||
margin: 4 8;
|
||||
background: darkblue 20%;
|
||||
color: darkblue;
|
||||
border: tall darkblue;
|
||||
padding: 1 2;
|
||||
}
|
||||
|
||||
/* The button class */
|
||||
Button {
|
||||
width: 1fr;
|
||||
}
|
||||
|
||||
/* Matches the question text */
|
||||
.question {
|
||||
text-style: bold;
|
||||
height: 100%;
|
||||
content-align: center middle;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
dock: bottom;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.layout import Container
|
||||
from textual.widget import Widget
|
||||
from textual.widgets import Header, Footer
|
||||
from textual.layout import Container, Horizontal
|
||||
from textual.widgets import Header, Footer, Static, Button
|
||||
|
||||
QUESTION = "Do you want to learn about Textual CSS?"
|
||||
|
||||
|
||||
class ExampleApp(App):
|
||||
@@ -9,10 +10,14 @@ class ExampleApp(App):
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(
|
||||
Widget(id="widget1"),
|
||||
Widget(id="widget2"),
|
||||
Widget(id="widget3"),
|
||||
Static(QUESTION, classes="question"),
|
||||
Horizontal(
|
||||
Button("Yes", variant="success"),
|
||||
Button("No", variant="error"),
|
||||
classes="buttons",
|
||||
),
|
||||
id="dialog",
|
||||
)
|
||||
|
||||
|
||||
app = ExampleApp()
|
||||
app = ExampleApp(css_path="dom4.css")
|
||||
|
||||
Reference in New Issue
Block a user