This commit is contained in:
Will McGugan
2021-08-06 11:54:20 +01:00
parent 3aacac6f23
commit 2ded0fa54b
14 changed files with 158 additions and 37 deletions

View File

@@ -9,16 +9,22 @@ class MyApp(App):
"""An example of a very simple Textual App"""
async def on_load(self, event: events.Load) -> None:
"""Bind keys with the app loads (but before entering application mode)"""
await self.bind("b", "view.toggle('sidebar')", "Toggle sidebar")
await self.bind("q", "quit", "Quit")
async def on_mount(self, event: events.Mount) -> None:
"""Create and dock the widgets."""
# A scrollview to contain the markdown file
body = ScrollView()
# Header / footer / dock
await self.view.dock(Header(), edge="top")
await self.view.dock(Footer(), edge="bottom")
await self.view.dock(Placeholder(), edge="left", size=30, name="sidebar")
# Dock the body in the remaining space
await self.view.dock(body, edge="right")
async def get_markdown(filename: str) -> None: