rich/examples/bars.py
Will McGugan e32a715728 simplify
2020-10-16 12:16:20 +01:00

18 lines
285 B
Python

"""
Use Bar to renderer a sort-of cirlce.
"""
import math
from rich.bar import Bar
from rich import print
SIZE = 40
for row in range(SIZE):
y = (row / SIZE) * 2 - 1
x = math.sqrt(1 - y * y)
bar = Bar(1, width=SIZE * 2, begin=1 - x, end=x, color="red")
print(bar)