Add borders to meter.

This commit is contained in:
kenkeiras 2017-05-21 14:08:29 +02:00
parent 851ab1de20
commit e3ab9583fe

View File

@ -1,5 +1,12 @@
import sys import sys
def show_depth(depth: int): def show_depth(depth: int):
sys.stdout.write("\r\x1b[K" + (u'' * int(depth / 2)) + (u'' * int(depth % 2)) + "\x1b[7m \x1b[0m\b") multiplier = 3
max_depth = 5
offset = int((max_depth - depth) / (2 / multiplier))
depth = depth * multiplier
offset -= int(depth % 2)
sys.stdout.write("\r|\x1b[K" + (u'' * int(depth / 2)) + (u'' * int(depth % 2)) + ' ' * offset + "|\x1b[7m \x1b[0m\b")
sys.stdout.flush() sys.stdout.flush()