mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 10:08:40 +00:00
docs
This commit is contained in:
parent
d6b31c2139
commit
59212b0fc4
1 changed files with 1 additions and 1 deletions
|
@ -62,7 +62,7 @@ For complete control over how a custom object is rendered to the terminal, you c
|
|||
Measuring Renderables
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Sometimes Rich needs to know how many characters an object will take up when rendering. The :class:`~rich.table.Table` class, for instance, will use this information to calculate the optimal dimensions for the columns. If you aren't using one of the renderable objects in the Rich module, you will need to supply a ``__measure__`` method which accepts a Console object and the maximum width and returns a :class:`~rich.measure.Measurement` object. The Measurement object should contain the *minimum* and *maximum* number of characters required to render.
|
||||
Sometimes Rich needs to know how many characters an object will take up when rendering. The :class:`~rich.table.Table` class, for instance, will use this information to calculate the optimal dimensions for the columns. If you aren't using one of the renderable objects in the Rich module, you will need to supply a ``__measure__`` method which accepts a :class:`~rich.console.Console` and the maximum width and returns a :class:`~rich.measure.Measurement` object. The Measurement object should contain the *minimum* and *maximum* number of characters required to render.
|
||||
|
||||
For example, if we are rendering a chess board, it would require a minimum of 8 characters to render. The maximum can be left as the maximum available width (assuming a centered board)::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue