Your best approach here will be to use the fr
dimension unit. This makes it easy to split a container up while retaining relative dimensions and it also mixes well with specific-value dimensions. So, in your code, it would make sense to say that one particular widget is simply height: 20
while the other is height: 1fr
.
As a simple example:
from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Header, Footer, Static
class HeightApp( App[ None ] ):
CSS = """
Static {
border: round green;
}
#top {
height: 20;
}
#bottom {
height: 1fr;
}
"""
def compose( self ) -> ComposeResult:
yield Header()
with Vertical():
yield Static( "This is 20 high", id="top" )
yield Static( "This is the rest of the terminal high", id="bottom" )
yield Footer()
if __name__ == "__main__":
HeightApp().run()