Skip to content

How to know max table rows or display continous text (tail like) ? #1090

Answered by willmcgugan
damsgithub asked this question in Q&A
Discussion options

You must be logged in to vote

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.

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 rich.log.Log class that has this functionality.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@damsgithub
Comment options

Answer selected by damsgithub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants