mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
added render measure
This commit is contained in:
32
sandbox/will/scrolly.py
Normal file
32
sandbox/will/scrolly.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from rich.text import Text
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import Static
|
||||
|
||||
text = "\n".join("FOO BAR bazz etc sdfsdf " * 20 for n in range(1000))
|
||||
|
||||
|
||||
class Content(Static):
|
||||
DEFAULT_CSS = """
|
||||
Content {
|
||||
width: auto;
|
||||
}
|
||||
"""
|
||||
|
||||
def render(self):
|
||||
return Text(text, no_wrap=False)
|
||||
|
||||
|
||||
class ScrollApp(App):
|
||||
CSS = """
|
||||
Screen {
|
||||
overflow: auto;
|
||||
}
|
||||
"""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Content()
|
||||
|
||||
|
||||
app = ScrollApp()
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
Reference in New Issue
Block a user