1
0
Fork 0
mirror of https://github.com/dbarzin/pandora-box.git synced 2025-07-19 13:29:42 +02:00
pandora-box/tests/progress-bar.py

36 lines
574 B
Python
Raw Normal View History

2022-06-11 20:06:30 +02:00
#!/usr/bin/python3
import curses
import time
curses.initscr()
2022-06-11 21:06:59 +02:00
2022-06-11 20:06:30 +02:00
def initBar():
global progress_win
progress_win = curses.newwin(3, 62, 3, 10)
progress_win.border(0)
2022-06-11 21:06:59 +02:00
2022-06-11 20:06:30 +02:00
def updateBar(progress):
global progress_win
rangex = (60 / float(100)) * progress
pos = int(rangex)
2022-06-11 21:06:59 +02:00
display = "#"
2022-06-11 20:06:30 +02:00
if pos != 0:
progress_win.addstr(1, pos, "{}".format(display))
progress_win.refresh()
2022-06-11 21:06:59 +02:00
2022-06-11 20:06:30 +02:00
initBar()
loading = 0
while loading < 100:
loading += 1
time.sleep(0.03)
updateBar(loading)
time.sleep(1)
curses.endwin()
curses.flushinp()