File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -371,11 +371,15 @@ def get_optimal_width(
371
371
rules : RulesMap ,
372
372
container_width : int ,
373
373
) -> int :
374
- """Get optimal width of the visual to display its content. Part of the Textual Visual protocol.
374
+ """Get optimal width of the Visual to display its content.
375
+
376
+ The exact definition of "optimal width" is dependant on the Visual, but
377
+ will typically be wide enough to display output without cropping or wrapping,
378
+ and without superfluous space.
375
379
376
380
Args:
377
- widget: Parent widget .
378
- container_size : The size of the container.
381
+ rules: A mapping of style rules, such as the Widgets `styles` object .
382
+ container_width : The size of the container in cells .
379
383
380
384
Returns:
381
385
A width in cells.
@@ -385,11 +389,11 @@ def get_optimal_width(
385
389
return max (line .cell_length for line in lines )
386
390
387
391
def get_height (self , rules : RulesMap , width : int ) -> int :
388
- """Get the height of the visual if rendered with the given width. Part of the Textual Visual protocol .
392
+ """Get the height of the Visual if rendered at the given width.
389
393
390
394
Args:
391
- widget: Parent widget .
392
- width: Width of visual.
395
+ rules: A mapping of style rules, such as the Widgets `styles` object .
396
+ width: Width of visual in cells .
393
397
394
398
Returns:
395
399
A height in lines.
You can’t perform that action at this time.
0 commit comments