repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
textual | docs/examples/guide/workers/weather03.py | .py | import httpx
from rich.text import Text
from textual import work
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Input, Static
class WeatherApp(App):
"""App to display the current weather."""
CSS_PATH = "weather.tcss"
def compose(self... | 43 | 1,307 |
textual | docs/examples/guide/workers/weather01.py | .py | import httpx
from rich.text import Text
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Input, Static
class WeatherApp(App):
"""App to display the current weather."""
CSS_PATH = "weather.tcss"
def compose(self) -> ComposeResult:
... | 41 | 1,262 |
textual | docs/examples/guide/workers/weather04.py | .py | import httpx
from rich.text import Text
from textual import work
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Input, Static
from textual.worker import Worker
class WeatherApp(App):
"""App to display the current weather."""
CSS_PATH = "w... | 48 | 1,493 |
textual | docs/examples/guide/content/playground.py | .py | from textual._markup_playground import MarkupPlayground
if __name__ == "__main__":
app = MarkupPlayground()
app.run()
| 6 | 127 |
textual | docs/examples/guide/content/renderables.py | .py | from rich.syntax import Syntax
from textual.app import App, ComposeResult, RenderResult
from textual.reactive import reactive
from textual.widget import Widget
class CodeView(Widget):
"""Widget to display Python code."""
DEFAULT_CSS = """
CodeView { height: auto; }
"""
code = reactive("")
... | 37 | 883 |
textual | docs/examples/guide/content/content01.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT1 = """\
Hello, [bold $text on $primary]World[/]!
[@click=app.notify('Hello, World!')]Click me[/]
"""
TEXT2 = """\
Markup will [bold]not[/bold] be displayed.
Tags will be left in the output.
"""
class ContentApp(App):
CSS = """... | 37 | 701 |
textual | docs/examples/guide/compound/byte02.py | .py | from __future__ import annotations
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.message import Message
from textual.reactive import reactive
from textual.widget import Widget
from textual.widgets import Input, Label, Switch
class BitSwitch(Widget):
"""A Switch ... | 107 | 2,581 |
textual | docs/examples/guide/compound/compound01.py | .py | from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Input, Label
class InputWithLabel(Widget):
"""An input with a label."""
DEFAULT_CSS = """
InputWithLabel {
layout: horizontal;
height: auto;
}
InputWithLabel Label {
pa... | 53 | 1,063 |
textual | docs/examples/guide/compound/byte01.py | .py | from __future__ import annotations
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.widget import Widget
from textual.widgets import Input, Label, Switch
class BitSwitch(Widget):
"""A Switch with a numeric label above it."""
DEFAULT_CSS = """
BitSwitch {
... | 82 | 1,675 |
textual | docs/examples/guide/compound/byte03.py | .py | from __future__ import annotations
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.geometry import clamp
from textual.message import Message
from textual.reactive import reactive
from textual.widget import Widget
from textual.widgets import Input, Label, Switch
class ... | 131 | 3,462 |
textual | docs/examples/how-to/layout.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll, VerticalScroll
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder):
DEFAULT_CSS = """
Header {
height: 3;
dock: top;
}
"""
class Footer(Placehol... | 70 | 1,302 |
textual | docs/examples/how-to/layout03.py | .py | from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder):
DEFAULT_CSS = """
Header {
height: 3;
dock: top;
}
"""
class Footer(Placeholder):
DEFAULT_CSS = """
Footer {
height: 3;
... | 49 | 871 |
textual | docs/examples/how-to/render_compose.py | .py | from time import time
from textual.app import App, ComposeResult, RenderResult
from textual.containers import Container
from textual.renderables.gradient import LinearGradient
from textual.widgets import Static
COLORS = [
"#881177",
"#aa3355",
"#cc6666",
"#ee9944",
"#eedd00",
"#99dd55",
"#... | 58 | 1,173 |
textual | docs/examples/how-to/center06.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
QUOTE = "Could not find you in Seattle and no terminal is in operation at your classified address."
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
#hello {
... | 31 | 597 |
textual | docs/examples/how-to/center02.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
#hello {
background: blue 50%;
border: wide white;
}
"""
def compose(self) -> ComposeRes... | 26 | 440 |
textual | docs/examples/how-to/containers01.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app to pl... | 30 | 567 |
textual | docs/examples/how-to/center08.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class CenterApp(App):
"""How to center things."""
CSS = """
.words {
background: blue 50%;
border: wide white;
width: auto;
}
"""
def compose(self) -> ComposeResult:
yield Static("Ho... | 24 | 475 |
textual | docs/examples/how-to/containers02.py | .py | from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app to play... | 30 | 555 |
textual | docs/examples/how-to/center04.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
QUOTE = "Could not find you in Seattle and no terminal is in operation at your classified address."
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
#hello {
... | 29 | 550 |
textual | docs/examples/how-to/containers04.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app to pl... | 40 | 769 |
textual | docs/examples/how-to/center07.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
QUOTE = "Could not find you in Seattle and no terminal is in operation at your classified address."
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
#hello {
... | 32 | 635 |
textual | docs/examples/how-to/center09.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
.words {
background: blue 50%;
border: wide white;
width: auto;
}
"""
def compos... | 28 | 525 |
textual | docs/examples/how-to/layout02.py | .py | from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder):
DEFAULT_CSS = """
Header {
height: 3;
dock: top;
}
"""
class Footer(Placeholder):
DEFAULT_CSS = """
Footer {
height: 3;
... | 38 | 650 |
textual | docs/examples/how-to/containers03.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app to pl... | 36 | 657 |
textual | docs/examples/how-to/inline02.py | .py | from datetime import datetime
from textual.app import App, ComposeResult
from textual.widgets import Digits
class ClockApp(App):
CSS = """
Screen {
align: center middle;
&:inline {
border: none;
height: 50vh;
Digits {
color: $success;
... | 39 | 782 |
textual | docs/examples/how-to/center10.py | .py | from textual.app import App, ComposeResult
from textual.containers import Center
from textual.widgets import Static
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
.words {
background: blue 50%;
border: wide white;
widt... | 31 | 617 |
textual | docs/examples/how-to/containers09.py | .py | from textual.app import App, ComposeResult
from textual.containers import Middle
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 5;
}
"""
class ContainerApp(App):
"""Simple app to play w... | 36 | 673 |
textual | docs/examples/how-to/center05.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
QUOTE = "Could not find you in Seattle and no terminal is in operation at your classified address."
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
#hello {
... | 30 | 578 |
textual | docs/examples/how-to/layout04.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder):
DEFAULT_CSS = """
Header {
height: 3;
dock: top;
}
"""
class Footer(Placeholder):
DEFAUL... | 40 | 739 |
textual | docs/examples/how-to/inline01.py | .py | from datetime import datetime
from textual.app import App, ComposeResult
from textual.widgets import Digits
class ClockApp(App):
CSS = """
Screen {
align: center middle;
}
#clock {
width: auto;
}
"""
def compose(self) -> ComposeResult:
yield Digits("", id="clock")... | 32 | 642 |
textual | docs/examples/how-to/center01.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
"""
def compose(self) -> ComposeResult:
yield Static("Hello, World!")
if __name__ == "__main__":
ap... | 21 | 350 |
textual | docs/examples/how-to/containers06.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app to pl... | 35 | 655 |
textual | docs/examples/how-to/layout06.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll, VerticalScroll
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder):
DEFAULT_CSS = """
Header {
height: 3;
dock: top;
}
"""
class Footer(Placehol... | 68 | 1,272 |
textual | docs/examples/how-to/layout01.py | .py | from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder): # (1)!
pass
class Footer(Placeholder): # (2)!
pass
class TweetScreen(Screen):
def compose(self) -> ComposeResult:
yield Header(id="Header") # (3)!
... | 28 | 523 |
textual | docs/examples/how-to/containers07.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app... | 35 | 667 |
textual | docs/examples/how-to/layout05.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll, VerticalScroll
from textual.screen import Screen
from textual.widgets import Placeholder
class Header(Placeholder):
DEFAULT_CSS = """
Header {
height: 3;
dock: top;
}
"""
class Footer(Placehol... | 54 | 1,049 |
textual | docs/examples/how-to/containers08.py | .py | from textual.app import App, ComposeResult
from textual.containers import Center, Right
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 5;
}
"""
class ContainerApp(App):
"""Simple app to... | 37 | 732 |
textual | docs/examples/how-to/containers05.py | .py | from textual.app import App, ComposeResult
from textual.containers import HorizontalGroup
from textual.widgets import Placeholder
class Box(Placeholder):
"""Example widget."""
DEFAULT_CSS = """
Box {
width: 16;
height: 8;
}
"""
class ContainerApp(App):
"""Simple app ... | 40 | 784 |
textual | docs/examples/how-to/center03.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class CenterApp(App):
"""How to center things."""
CSS = """
Screen {
align: center middle;
}
#hello {
background: blue 50%;
border: wide white;
width: auto;
}
"""
def compos... | 27 | 461 |
textual | docs/examples/styles/scrollbar_size2.py | .py | from textual.app import App
from textual.containers import Horizontal, ScrollableContainer
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has... | 29 | 816 |
textual | docs/examples/styles/link_color_hover.py | .py | from textual.app import App
from textual.widgets import Label
class LinkHoverColorApp(App):
CSS_PATH = "link_color_hover.tcss"
def compose(self):
yield Label(
"Visit the [link='https://textualize.io']Textualize[/link] website.",
id="lbl1", # (1)!
)
yield Label... | 30 | 763 |
textual | docs/examples/styles/layout.py | .py | from textual.app import App
from textual.containers import Container
from textual.widgets import Label
class LayoutApp(App):
CSS_PATH = "layout.tcss"
def compose(self):
yield Container(
Label("Layout"),
Label("Is"),
Label("Vertical"),
id="vertical-layou... | 27 | 557 |
textual | docs/examples/styles/link_background.py | .py | from textual.app import App
from textual.widgets import Label
class LinkBackgroundApp(App):
CSS_PATH = "link_background.tcss"
def compose(self):
yield Label(
"Visit the [link='https://textualize.io']Textualize[/link] website.",
id="lbl1", # (1)!
)
yield Label(... | 30 | 762 |
textual | docs/examples/styles/scrollbar_size.py | .py | from textual.app import App
from textual.containers import ScrollableContainer
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, ... | 25 | 658 |
textual | docs/examples/styles/visibility_containers.py | .py | from textual.app import App
from textual.containers import Horizontal, VerticalScroll
from textual.widgets import Placeholder
class VisibilityContainersApp(App):
CSS_PATH = "visibility_containers.tcss"
def compose(self):
yield VerticalScroll(
Horizontal(
Placeholder(),
... | 35 | 828 |
textual | docs/examples/styles/color_auto.py | .py | from textual.app import App
from textual.widgets import Label
class ColorApp(App):
CSS_PATH = "color_auto.tcss"
def compose(self):
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl1")
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl2")
yield Label(... | 19 | 601 |
textual | docs/examples/styles/link_color.py | .py | from textual.app import App
from textual.widgets import Label
class LinkColorApp(App):
CSS_PATH = "link_color.tcss"
def compose(self):
yield Label(
"Visit the [link='https://textualize.io']Textualize[/link] website.",
id="lbl1", # (1)!
)
yield Label(
... | 30 | 747 |
textual | docs/examples/styles/height.py | .py | from textual.app import App
from textual.widget import Widget
class HeightApp(App):
CSS_PATH = "height.tcss"
def compose(self):
yield Widget()
if __name__ == "__main__":
app = HeightApp()
app.run()
| 15 | 227 |
textual | docs/examples/styles/scrollbar_gutter.py | .py | from textual.app import App
from textual.widgets import Static
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where t... | 23 | 595 |
textual | docs/examples/styles/display.py | .py | from textual.app import App
from textual.widgets import Static
class DisplayApp(App):
CSS_PATH = "display.tcss"
def compose(self):
yield Static("Widget 1")
yield Static("Widget 2", classes="remove")
yield Static("Widget 3")
if __name__ == "__main__":
app = DisplayApp()
app.r... | 17 | 325 |
textual | docs/examples/styles/outline.py | .py | from textual.app import App
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where th... | 23 | 553 |
textual | docs/examples/styles/visibility.py | .py | from textual.app import App
from textual.widgets import Label
class VisibilityApp(App):
CSS_PATH = "visibility.tcss"
def compose(self):
yield Label("Widget 1")
yield Label("Widget 2", classes="invisible")
yield Label("Widget 3")
if __name__ == "__main__":
app = VisibilityApp()
... | 17 | 333 |
textual | docs/examples/styles/border_all.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class AllBordersApp(App):
CSS_PATH = "border_all.tcss"
def compose(self):
yield Grid(
Label("ascii", id="ascii"),
Label("blank", id="blank"),
Label("dashed", id="dashe... | 33 | 925 |
textual | docs/examples/styles/grid.py | .py | from textual.app import App
from textual.widgets import Static
class GridApp(App):
CSS_PATH = "grid.tcss"
def compose(self):
yield Static("Grid cell 1\n\nrow-span: 3;\ncolumn-span: 2;", id="static1")
yield Static("Grid cell 2", id="static2")
yield Static("Grid cell 3", id="static3")
... | 21 | 582 |
textual | docs/examples/styles/content_align_all.py | .py | from textual.app import App
from textual.widgets import Label
class AllContentAlignApp(App):
CSS_PATH = "content_align_all.tcss"
def compose(self):
yield Label("left top", id="left-top")
yield Label("center top", id="center-top")
yield Label("right top", id="right-top")
yield ... | 23 | 710 |
textual | docs/examples/styles/max_width.py | .py | from textual.app import App
from textual.containers import VerticalScroll
from textual.widgets import Placeholder
class MaxWidthApp(App):
CSS_PATH = "max_width.tcss"
def compose(self):
yield VerticalScroll(
Placeholder("max-width: 50h", id="p1"),
Placeholder("max-width: 999", ... | 21 | 510 |
textual | docs/examples/styles/grid_size_columns.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class MyApp(App):
CSS_PATH = "grid_size_columns.tcss"
def compose(self):
yield Grid(
Label("1"),
Label("2"),
Label("3"),
Label("4"),
Label("5")... | 22 | 393 |
textual | docs/examples/styles/margin_all.py | .py | from textual.app import App
from textual.containers import Container, Grid
from textual.widgets import Placeholder
class MarginAllApp(App):
CSS_PATH = "margin_all.tcss"
def compose(self):
yield Grid(
Container(Placeholder("no margin", id="p1"), classes="bordered"),
Container(P... | 25 | 951 |
textual | docs/examples/styles/scrollbar_visibility.py | .py | from textual.app import App
from textual.containers import Horizontal, VerticalScroll
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone... | 28 | 764 |
textual | docs/examples/styles/link_style_hover.py | .py | from textual.app import App
from textual.widgets import Label
class LinkHoverStyleApp(App):
CSS_PATH = "link_style_hover.tcss"
def compose(self):
yield Label(
"Visit the [link='https://textualize.io']Textualize[/link] website.",
id="lbl1", # (1)!
)
yield Label... | 30 | 763 |
textual | docs/examples/styles/column_span.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Placeholder
class MyApp(App):
CSS_PATH = "column_span.tcss"
def compose(self):
yield Grid(
Placeholder(id="p1"),
Placeholder(id="p2"),
Placeholder(id="p3"),
Plac... | 24 | 511 |
textual | docs/examples/styles/background_tint.py | .py | from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Label
class BackgroundTintApp(App):
CSS_PATH = "background_tint.tcss"
def compose(self) -> ComposeResult:
with Vertical(id="tint1"):
yield Label("0%")
with Vertical(id="t... | 25 | 631 |
textual | docs/examples/styles/color.py | .py | from textual.app import App
from textual.widgets import Label
class ColorApp(App):
CSS_PATH = "color.tcss"
def compose(self):
yield Label("I'm red!", id="label1")
yield Label("I'm rgb(0, 255, 0)!", id="label2")
yield Label("I'm hsl(240, 100%, 50%)!", id="label3")
if __name__ == "__m... | 17 | 363 |
textual | docs/examples/styles/offset.py | .py | from textual.app import App
from textual.widgets import Label
class OffsetApp(App):
CSS_PATH = "offset.tcss"
def compose(self):
yield Label("Paul (offset 8 2)", classes="paul")
yield Label("Duncan (offset 4 10)", classes="duncan")
yield Label("Chani (offset 0 -3)", classes="chani")
... | 17 | 383 |
textual | docs/examples/styles/grid_gutter.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class MyApp(App):
CSS_PATH = "grid_gutter.tcss"
def compose(self):
yield Grid(
Label("1"),
Label("2"),
Label("3"),
Label("4"),
Label("5"),
... | 25 | 459 |
textual | docs/examples/styles/keyline_horizontal.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Placeholder
class KeylineApp(App):
CSS_PATH = "keyline_horizontal.tcss"
def compose(self) -> ComposeResult:
with Horizontal():
yield Placeholder()
yield Placeholder... | 19 | 421 |
textual | docs/examples/styles/scrollbars2.py | .py | from textual.app import App
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where th... | 24 | 569 |
textual | docs/examples/styles/row_span.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Placeholder
class MyApp(App):
CSS_PATH = "row_span.tcss"
def compose(self):
yield Grid(
Placeholder(id="p1"),
Placeholder(id="p2"),
Placeholder(id="p3"),
Placeho... | 24 | 508 |
textual | docs/examples/styles/overflow.py | .py | from textual.app import App
from textual.containers import Horizontal, VerticalScroll
from textual.widgets import Static
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gon... | 27 | 788 |
textual | docs/examples/styles/text_style_all.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the... | 33 | 1,015 |
textual | docs/examples/styles/keyline.py | .py | from textual.app import App, ComposeResult
from textual.containers import Grid
from textual.widgets import Placeholder
class KeylineApp(App):
CSS_PATH = "keyline.tcss"
def compose(self) -> ComposeResult:
with Grid():
yield Placeholder(id="foo")
yield Placeholder(id="bar")
... | 20 | 488 |
textual | docs/examples/styles/border.py | .py | from textual.app import App
from textual.widgets import Label
class BorderApp(App):
CSS_PATH = "border.tcss"
def compose(self):
yield Label("My border is solid red", id="label1")
yield Label("My border is dashed green", id="label2")
yield Label("My border is tall blue", id="label3")
... | 17 | 384 |
textual | docs/examples/styles/width_comparison.py | .py | from textual.app import App
from textual.containers import Horizontal
from textual.widgets import Label, Placeholder, Static
class Ruler(Static):
def compose(self):
ruler_text = "····•" * 100
yield Label(ruler_text)
class WidthComparisonApp(App):
CSS_PATH = "width_comparison.tcss"
def c... | 33 | 796 |
textual | docs/examples/styles/border_subtitle_align.py | .py | from textual.app import App
from textual.widgets import Label
class BorderSubtitleAlignApp(App):
CSS_PATH = "border_subtitle_align.tcss"
def compose(self):
lbl = Label("My subtitle is on the left.", id="label1")
lbl.border_subtitle = "< Left"
yield lbl
lbl = Label("My subtitl... | 25 | 610 |
textual | docs/examples/styles/align.py | .py | from textual.app import App
from textual.widgets import Label
class AlignApp(App):
CSS_PATH = "align.tcss"
def compose(self):
yield Label("Vertical alignment with [b]Textual[/]", classes="box")
yield Label("Take note, browsers.", classes="box")
if __name__ == "__main__":
app = AlignApp(... | 16 | 336 |
textual | docs/examples/styles/height_comparison.py | .py | from textual.app import App
from textual.containers import VerticalScroll
from textual.widgets import Label, Placeholder, Static
class Ruler(Static):
def compose(self):
ruler_text = "·\n·\n·\n·\n•\n" * 100
yield Label(ruler_text)
class HeightComparisonApp(App):
CSS_PATH = "height_comparison.... | 33 | 817 |
textual | docs/examples/styles/outline_vs_border.py | .py | from textual.app import App
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where th... | 25 | 690 |
textual | docs/examples/styles/grid_size_both.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class MyApp(App):
CSS_PATH = "grid_size_both.tcss"
def compose(self):
yield Grid(
Label("1"),
Label("2"),
Label("3"),
Label("4"),
Label("5"),
... | 22 | 390 |
textual | docs/examples/styles/max_height.py | .py | from textual.app import App
from textual.containers import Horizontal
from textual.widgets import Placeholder
class MaxHeightApp(App):
CSS_PATH = "max_height.tcss"
def compose(self):
yield Horizontal(
Placeholder("max-height: 10w", id="p1"),
Placeholder("max-height: 999", id="... | 21 | 509 |
textual | docs/examples/styles/opacity.py | .py | from textual.app import App
from textual.widgets import Label
class OpacityApp(App):
CSS_PATH = "opacity.tcss"
def compose(self):
yield Label("opacity: 0%", id="zero-opacity")
yield Label("opacity: 25%", id="quarter-opacity")
yield Label("opacity: 50%", id="half-opacity")
yiel... | 19 | 494 |
textual | docs/examples/styles/margin.py | .py | from textual.app import App
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where th... | 23 | 550 |
textual | docs/examples/styles/text_wrap.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear."""
class WrapApp(App):
CSS_PATH = "text_wrap.tcss"
def compose(self) -> ComposeResult:
yield... | 18 | 452 |
textual | docs/examples/styles/content_align.py | .py | from textual.app import App
from textual.widgets import Label
class ContentAlignApp(App):
CSS_PATH = "content_align.tcss"
def compose(self):
yield Label("With [i]content-align[/] you can...", id="box1")
yield Label("...[b]Easily align content[/]...", id="box2")
yield Label("...Horizon... | 17 | 432 |
textual | docs/examples/styles/text_overflow.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear."""
class WrapApp(App):
CSS_PATH = "text_overflow.tcss"
def compose(self) -> ComposeResult:
y... | 19 | 497 |
textual | docs/examples/styles/padding_all.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Placeholder
class PaddingAllApp(App):
CSS_PATH = "padding_all.tcss"
def compose(self):
yield Grid(
Placeholder("no padding", id="p1"),
Placeholder("padding: 1", id="p2"),
Pl... | 25 | 703 |
textual | docs/examples/styles/min_width.py | .py | from textual.app import App
from textual.containers import VerticalScroll
from textual.widgets import Placeholder
class MinWidthApp(App):
CSS_PATH = "min_width.tcss"
def compose(self):
yield VerticalScroll(
Placeholder("min-width: 25%", id="p1"),
Placeholder("min-width: 75%", ... | 21 | 512 |
textual | docs/examples/styles/border_title_align.py | .py | from textual.app import App
from textual.widgets import Label
class BorderTitleAlignApp(App):
CSS_PATH = "border_title_align.tcss"
def compose(self):
lbl = Label("My title is on the left.", id="label1")
lbl.border_title = "< Left"
yield lbl
lbl = Label("My title is centered",... | 25 | 583 |
textual | docs/examples/styles/grid_columns.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class MyApp(App):
CSS_PATH = "grid_columns.tcss"
def compose(self):
yield Grid(
Label("1fr"),
Label("width = 16"),
Label("2fr"),
Label("1fr"),
... | 27 | 556 |
textual | docs/examples/styles/border_title_colors.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Label
class BorderTitleApp(App):
CSS_PATH = "border_title_colors.tcss"
def compose(self) -> ComposeResult:
yield Label("Hello, World!")
def on_mount(self) -> None:
label = self.query_one(Label)
label.border_ti... | 20 | 460 |
textual | docs/examples/styles/border_sub_title_align_all.py | .py | from textual.app import App
from textual.containers import Container, Grid
from textual.widgets import Label
def make_label_container( # (11)!
text: str, id: str, border_title: str, border_subtitle: str
) -> Container:
lbl = Label(text, id=id)
lbl.border_title = border_title
lbl.border_subtitle = bor... | 76 | 2,444 |
textual | docs/examples/styles/links.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT = """\
Here is a [@click='app.bell']link[/] which you can click!
"""
class LinksApp(App):
CSS_PATH = "links.tcss"
def compose(self) -> ComposeResult:
yield Static(TEXT)
yield Static(TEXT, id="custom")
if __n... | 20 | 376 |
textual | docs/examples/styles/outline_all.py | .py | from textual.app import App
from textual.containers import Grid
from textual.widgets import Label
class AllOutlinesApp(App):
CSS_PATH = "outline_all.tcss"
def compose(self):
yield Grid(
Label("ascii", id="ascii"),
Label("blank", id="blank"),
Label("dashed", id="das... | 32 | 886 |
textual | docs/examples/styles/box_sizing.py | .py | from textual.app import App
from textual.widgets import Static
class BoxSizingApp(App):
CSS_PATH = "box_sizing.tcss"
def compose(self):
yield Static("I'm using border-box!", id="static1")
yield Static("I'm using content-box!", id="static2")
if __name__ == "__main__":
app = BoxSizingApp(... | 16 | 336 |
textual | docs/examples/styles/min_height.py | .py | from textual.app import App
from textual.containers import Horizontal
from textual.widgets import Placeholder
class MinHeightApp(App):
CSS_PATH = "min_height.tcss"
def compose(self):
yield Horizontal(
Placeholder("min-height: 25%", id="p1"),
Placeholder("min-height: 75%", id="... | 21 | 509 |
textual | docs/examples/styles/padding.py | .py | from textual.app import App
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where th... | 23 | 553 |
textual | docs/examples/styles/align_all.py | .py | from textual.app import App, ComposeResult
from textual.containers import Container
from textual.widgets import Label
class AlignAllApp(App):
"""App that illustrates all alignments."""
CSS_PATH = "align_all.tcss"
def compose(self) -> ComposeResult:
yield Container(Label("left top"), id="left-top... | 25 | 894 |
textual | docs/examples/styles/hatch.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal, Vertical
from textual.widgets import Static
HATCHES = ("cross", "horizontal", "custom", "left", "right")
class HatchApp(App):
CSS_PATH = "hatch.tcss"
def compose(self) -> ComposeResult:
with Horizontal():
... | 23 | 577 |
textual | docs/examples/styles/scrollbar_corner_color.py | .py | from textual.app import App
from textual.widgets import Label
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where th... | 24 | 633 |
textual | docs/examples/styles/tint.py | .py | from textual.app import App
from textual.color import Color
from textual.widgets import Label
class TintApp(App):
CSS_PATH = "tint.tcss"
def compose(self):
color = Color.parse("green")
for tint_alpha in range(0, 101, 10):
widget = Label(f"tint: green {tint_alpha}%;")
w... | 20 | 471 |
textual | docs/examples/styles/text_opacity.py | .py | from textual.app import App
from textual.widgets import Label
class TextOpacityApp(App):
CSS_PATH = "text_opacity.tcss"
def compose(self):
yield Label("text-opacity: 0%", id="zero-opacity")
yield Label("text-opacity: 25%", id="quarter-opacity")
yield Label("text-opacity: 50%", id="hal... | 19 | 532 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.