added render measure

This commit is contained in:
Will McGugan
2022-09-18 11:27:48 +01:00
parent 9838d3b34e
commit 743b43a6c2
3 changed files with 69 additions and 0 deletions

32
sandbox/will/scrolly.py Normal file
View 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()