def test(location):
"""Test with a single bar.
Input: location - tuple (x, y) defining the position on the
screen of the progress bar
"""
# fd is an object that has a .write() method
writer = Writer(location)
pbar = ProgressBar(fd=writer)
# progressbar usage
pbar.start()
for i in range(100):
# do stuff
# time taken for process is function of line number
# t_wait = location[1] / 100
# time take is random
t_wait = random.random() / 50
time.sleep(t_wait)
# update calls the write method
pbar.update(i)
pbar.finish()
评论列表
文章目录