mirror of
https://github.com/Textualize/rich.git
synced 2025-09-11 12:56:42 +00:00
bar refactor
This commit is contained in:
parent
e1cb4796ba
commit
447ed72fe3
12 changed files with 320 additions and 339 deletions
18
examples/bars.py
Normal file
18
examples/bars.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
"""
|
||||
|
||||
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.0, width=SIZE * 2, begin=1 - x, end=x, color="red")
|
||||
print(bar)
|
Loading…
Add table
Add a link
Reference in a new issue