From eadc162febbcc05727b60a9c69d697cd2007c5cc Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Wed, 12 Aug 2020 21:34:24 +0100 Subject: [PATCH] ignore overflow in columns example --- examples/columns.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/columns.py b/examples/columns.py index 2c1b9bfb..3fcde8f5 100644 --- a/examples/columns.py +++ b/examples/columns.py @@ -7,7 +7,7 @@ The data is pulled from https://randomuser.me import json from urllib.request import urlopen -from rich import print +from rich.console import Console from rich.columns import Columns from rich.panel import Panel @@ -18,8 +18,10 @@ def get_content(user): name = f"{user['name']['first']} {user['name']['last']}" return f"[b]{name}[/b]\n[yellow]{country}" +console = Console() + users = json.loads(urlopen("https://randomuser.me/api/?results=30").read())["results"] -print(users) +console.print(users, overflow="ignore", crop=False) user_renderables = [Panel(get_content(user), expand=True) for user in users] -print(Columns(user_renderables)) +console.print(Columns(user_renderables))