mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
new layout geometry
This commit is contained in:
24
examples/new.py
Normal file
24
examples/new.py
Normal 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()
|
||||
Reference in New Issue
Block a user