textual
textual copied to clipboard
The terminal is empty until I resize it
I used simple code:
from textual.app import App
from textual.widgets import Placeholder
class SimpleApp(App):
async def on_mount(self) -> None:
await self.view.dock(Placeholder(), edge="left", size=40)
await self.view.dock(Placeholder(), Placeholder(), edge="top")
SimpleApp.run(log="textual.log")
Then, I ran the code but nothing appeared until i resized terminal
https://user-images.githubusercontent.com/40739871/177348394-7e87f1a6-0ec3-44a3-ae3c-9c57783db12a.mp4
Hi, I had this issue as well. I am new to this library, but I found a quick fix.
import os
from textual._types import MessageTarget
from textual.app import App
from textual.events import Resize
from textual.geometry import Size
from textual.widgets import Placeholder
class SimpleApp(App):
async def on_mount(self) -> None:
size = os.get_terminal_size()
await self.view.dock(Placeholder(), edge="left", size=40)
await self.view.dock(Placeholder(), Placeholder(), edge="top")
await self.on_resize(Resize(MessageTarget, Size(width=size.columns, height=size.lines)))
SimpleApp.run(log="textual.log")
@Shinobou wow its works! Thanks :)
https://github.com/Textualize/textual/wiki/Sorry-we-closed-your-issue
Did we solve your problem?
Glad we could help!