new layout geometry

This commit is contained in:
Will McGugan
2021-06-28 22:01:22 +01:00
parent 2308d01606
commit 1420c0baef
7 changed files with 381 additions and 63 deletions

24
examples/new.py Normal file
View File

@@ -0,0 +1,24 @@
from textual import events
from textual.app import App, Bind
from textual.widgets import Header, Placeholder, MarkdownViewer
class MyApp(App):
KEYS = {
"q, ctrl+c": Bind("quit"),
"b": Bind("view.toggle('left')", "Toggle Sidebar"),
}
async def on_load(self, event: events.Load) -> None:
self.bind(self.KEYS)
async def on_startup(self, event: events.Startup) -> None:
await self.view.mount(
header=Header(),
left=Placeholder(),
body=MarkdownViewer("readme.md"),
)
app = MyApp(title="Simple Textual App")
app.run()