How to know max table rows or display continous text (tail like) ? #1090
-
Hello, I use rich to display messages in a table (itself in a Layout), each message adding a row to the table. All is well until the displayed table is full and the added row no longer can appear in it, so it is not displayed at all. Is there a way to know when the table is "full", so that I can for example clear its content and start over ? Or may be I should not use a table ? Is there a way to display continuous text messages in a particular Layout that will automatically scroll (tail like)? thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You probably don't need a table here. If you create a renderable using the console protocol you can refer to class MyLog:
def __rich_console__(self, console, options):
for line in self.lines[-options.height:]:
yield line
In the future I'll probably add a |
Beta Was this translation helpful? Give feedback.
You probably don't need a table here. If you create a renderable using the console protocol you can refer to
options.height
and return that many lines.In the future I'll probably add a
rich.log.Log
class that has this functionality.