textual icon indicating copy to clipboard operation
textual copied to clipboard

The terminal is empty until I resize it

Open Stepashka20 opened this issue 3 years ago • 2 comments

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

Stepashka20 avatar Jul 05 '22 14:07 Stepashka20

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")

KeenanOH avatar Jul 09 '22 14:07 KeenanOH

@Shinobou wow its works! Thanks :)

Stepashka20 avatar Jul 10 '22 17:07 Stepashka20

https://github.com/Textualize/textual/wiki/Sorry-we-closed-your-issue

willmcgugan avatar Oct 25 '22 09:10 willmcgugan

Did we solve your problem?

Glad we could help!

github-actions[bot] avatar Oct 25 '22 09:10 github-actions[bot]