mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
25 lines
645 B
Python
25 lines
645 B
Python
from rich.markdown import Markdown
|
|
|
|
from textual import events
|
|
from textual.app import App
|
|
from textual.widgets.header import Header
|
|
from textual.widgets.placeholder import Placeholder
|
|
from textual.widgets.window import Window
|
|
|
|
with open("richreadme.md", "rt") as fh:
|
|
readme = Markdown(fh.read(), hyperlinks=True, code_theme="fruity")
|
|
|
|
|
|
class MyApp(App):
|
|
|
|
KEYS = {"q": "quit", "ctrl+c": "quit", "b": "view.toggle('left')"}
|
|
|
|
async def on_startup(self, event: events.Startup) -> None:
|
|
await self.view.mount_all(
|
|
header=Header(self.title), left=Placeholder(), body=Window(readme)
|
|
)
|
|
|
|
|
|
app = MyApp()
|
|
app.run()
|