mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
@@ -1,10 +1,9 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.widgets import Header, Footer, Label, Input
|
||||
|
||||
|
||||
class InputWidthAutoApp(App[None]):
|
||||
|
||||
CSS = """
|
||||
Input.auto {
|
||||
width: auto;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical, Horizontal
|
||||
from textual.containers import VerticalScroll, Horizontal
|
||||
from textual.widgets import (
|
||||
Header,
|
||||
Footer,
|
||||
@@ -17,7 +17,6 @@ from textual.widgets import (
|
||||
|
||||
|
||||
class WidgetDisableTestApp(App[None]):
|
||||
|
||||
CSS = """
|
||||
Horizontal {
|
||||
height: auto;
|
||||
@@ -54,7 +53,7 @@ class WidgetDisableTestApp(App[None]):
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header()
|
||||
yield Vertical(
|
||||
yield VerticalScroll(
|
||||
Horizontal(
|
||||
Button(),
|
||||
Button(variant="primary"),
|
||||
@@ -77,7 +76,7 @@ class WidgetDisableTestApp(App[None]):
|
||||
|
||||
def on_mount(self) -> None:
|
||||
self.query_one(TextLog).write("Hello, World!")
|
||||
self.query_one("#test-container", Vertical).disabled = True
|
||||
self.query_one("#test-container", VerticalScroll).disabled = True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from rich.text import Text
|
||||
|
||||
from textual.app import App, ComposeResult, RenderResult
|
||||
from textual.containers import Vertical
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.widgets import Header, Footer
|
||||
from textual.widget import Widget
|
||||
|
||||
@@ -32,7 +32,7 @@ class Tester(Widget, can_focus=True):
|
||||
class StyleBugApp(App[None]):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header()
|
||||
with Vertical():
|
||||
with VerticalScroll():
|
||||
for n in range(40):
|
||||
yield Tester(n)
|
||||
yield Footer()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Horizontal, Vertical
|
||||
from textual.containers import Horizontal, VerticalScroll
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ class StaticText(Static):
|
||||
|
||||
|
||||
class FRApp(App):
|
||||
|
||||
CSS = """
|
||||
StaticText {
|
||||
height: 1fr;
|
||||
@@ -39,7 +38,7 @@ class FRApp(App):
|
||||
"""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Vertical(
|
||||
yield VerticalScroll(
|
||||
StaticText("HEADER", id="header"),
|
||||
Horizontal(
|
||||
StaticText("foo", id="foo"),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.screen import Screen
|
||||
from textual.widgets import Header, Footer, Label
|
||||
from textual.containers import Vertical, Container
|
||||
from textual.containers import VerticalScroll, Container
|
||||
|
||||
|
||||
class Overlay(Container):
|
||||
@@ -9,12 +9,12 @@ class Overlay(Container):
|
||||
yield Label("This should float over the top")
|
||||
|
||||
|
||||
class Body1(Vertical):
|
||||
class Body1(VerticalScroll):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Label("My God! It's full of stars! " * 300)
|
||||
|
||||
|
||||
class Body2(Vertical):
|
||||
class Body2(VerticalScroll):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Label("My God! It's full of stars! " * 300)
|
||||
|
||||
@@ -36,7 +36,6 @@ class Bad(Screen):
|
||||
|
||||
|
||||
class Layers(App[None]):
|
||||
|
||||
CSS = """
|
||||
Screen {
|
||||
layers: base higher;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from rich.text import Text
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.widget import Widget
|
||||
from textual.widgets import TextLog
|
||||
|
||||
@@ -21,32 +21,32 @@ class ScrollViewApp(App):
|
||||
Screen {
|
||||
align: center middle;
|
||||
}
|
||||
|
||||
|
||||
TextLog {
|
||||
width:13;
|
||||
height:10;
|
||||
height:10;
|
||||
}
|
||||
|
||||
Vertical{
|
||||
VerticalScroll {
|
||||
width:13;
|
||||
height: 10;
|
||||
overflow: scroll;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
MyWidget {
|
||||
width:13;
|
||||
height:auto;
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield TextLog()
|
||||
yield Vertical(MyWidget())
|
||||
yield VerticalScroll(MyWidget())
|
||||
|
||||
def on_ready(self) -> None:
|
||||
self.query_one(TextLog).write("\n".join(f"{n} 0123456789" for n in range(20)))
|
||||
self.query_one(Vertical).scroll_end(animate=False)
|
||||
self.query_one(VerticalScroll).scroll_end(animate=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ class NestedAutoApp(App[None]):
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
self._static = Static("", id="my-static")
|
||||
yield Vertical(
|
||||
Vertical(
|
||||
yield VerticalScroll(
|
||||
VerticalScroll(
|
||||
self._static,
|
||||
id="my-static-wrapper",
|
||||
),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.widgets import Label, Static
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ class Box(Static):
|
||||
|
||||
|
||||
class OffsetsApp(App):
|
||||
|
||||
CSS = """
|
||||
|
||||
#box1 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from textual.app import App
|
||||
from textual.containers import Vertical
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Visibility(App):
|
||||
Screen {
|
||||
layout: horizontal;
|
||||
}
|
||||
Vertical {
|
||||
VerticalScroll {
|
||||
width: 1fr;
|
||||
border: solid red;
|
||||
}
|
||||
@@ -30,13 +30,12 @@ class Visibility(App):
|
||||
"""
|
||||
|
||||
def compose(self):
|
||||
|
||||
yield Vertical(
|
||||
yield VerticalScroll(
|
||||
Static("foo"),
|
||||
Static("float", classes="float"),
|
||||
id="container1",
|
||||
)
|
||||
yield Vertical(
|
||||
yield VerticalScroll(
|
||||
Static("bar"),
|
||||
Static("float", classes="float"),
|
||||
id="container2",
|
||||
|
||||
Reference in New Issue
Block a user