mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docs
This commit is contained in:
24
docs/examples/styles/display.py
Normal file
24
docs/examples/styles/display.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from textual.app import App
|
||||
from textual.widget import Widget
|
||||
|
||||
|
||||
class WidthApp(App):
|
||||
CSS = """
|
||||
Screen > Widget {
|
||||
height: 5;
|
||||
background: blue;
|
||||
color: white;
|
||||
border: heavy white;
|
||||
}
|
||||
Widget.hidden {
|
||||
display: none;
|
||||
}
|
||||
"""
|
||||
|
||||
def compose(self):
|
||||
yield Widget(id="widget1")
|
||||
yield Widget(id="widget2", classes="hidden")
|
||||
yield Widget(id="widget3")
|
||||
|
||||
|
||||
app = WidthApp()
|
||||
18
docs/examples/styles/height.py
Normal file
18
docs/examples/styles/height.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from textual.app import App
|
||||
from textual.widget import Widget
|
||||
|
||||
|
||||
class WidthApp(App):
|
||||
CSS = """
|
||||
Screen > Widget {
|
||||
background: green;
|
||||
height: 50%;
|
||||
color: white;
|
||||
}
|
||||
"""
|
||||
|
||||
def compose(self):
|
||||
yield Widget()
|
||||
|
||||
|
||||
app = WidthApp()
|
||||
@@ -4,9 +4,10 @@ from textual.widget import Widget
|
||||
|
||||
class WidthApp(App):
|
||||
CSS = """
|
||||
Widget {
|
||||
background: blue 50%;
|
||||
Screen > Widget {
|
||||
background: green;
|
||||
width: 50%;
|
||||
color: white;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user