Open plotski opened 3 years ago
Try wrapping the window in a ConditionalContainer that is initially hidden. This will not take up any height in the layout. See prompt-toolkit\shortcuts\prompt.py
for an example. Maybe even use this approach for all your windows, if there's a predictable number of them?
Hey, thank you for your reply.
But this doesn't work because there are no Windows initially when the Layout is created. The contents of the main HSplit are created dynamically while the application is running.
I want to initialize my layout with an empty
HSplit
. Children are added and removed later while the application is running. The first child is not available when I create the Layout.I tried replacing the exception with a
pass
in https://github.com/prompt-toolkit/python-prompt-toolkit/blob/10f5cca40f40f5dbda4c521ba72270b23f72628c/prompt_toolkit/layout/layout.py#L63 and the tests were passing, but then thecurrent_control
property broke. It looks like non-emptiness is built into the guts of the Layout class.I could add an empty window, but that adds an empty line. I could remove that window when I've added the first real widget, but that's not very elegant or obvious why that's necessary.