Ooooh Shiny!
As previously mentioned, this blog is more of a note to self than a real blog.. anyways!
Sometimes you stumble upon stuff so incredible useful that it's close to rival the babel fish. Well, that's a slight exaggeration, but still.
Today I discovered pyboxen
, and they are beautiful. I'm taking the liberty to steal some example code form the pyboxen
github page in the hope that the people that might fly by this blog will go there and show their appreciation.
Just look at this!
from pyboxen import boxen
print(
boxen(
"Python is cool!",
padding=1,
margin=1,
color="cyan",
)
)
And if you think this is cool, just wait 'till you see
rich
!
from pyboxen import boxen
# Multiple texts
print(
boxen(
"Python is cool!",
"Yeah it totally is!",
"I [red]:heart:[/red] [yellow bold]Python[/]!", # You can even use Rich syntax here too!
padding=1,
margin=1,
color="cyan",
)
)
# Rich renderables, with a mix of strings and renderables
from rich.table import Table
table = Table(show_header=True, header_style="bold magenta")
table.add_column("Date", style="dim", width=12)
table.add_column("Title")
table.add_column("Production Budget", justify="right")
table.add_column("Box Office", justify="right")
table.add_row(
"Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$275,000,000", "$375,126,118"
)
table.add_row(
"May 25, 2018",
"[red]Solo[/red]: A Star Wars Story",
"$275,000,000",
"$393,151,347",
)
table.add_row(
"Dec 15, 2017",
"Star Wars Ep. VIII: The Last Jedi",
"$262,000,000",
"[bold]$1,332,539,889[/bold]",
)
print(
boxen(
"Python is cool!",
table
)
)
These tools are so freaking cool! The python multiverse never stops to amaze me.