aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpux <pux@pux.dom>2020-02-08 10:13:10 +0100
committerpux <pux@pux.dom>2020-02-08 10:13:10 +0100
commit04beba2aefc66a1230b9d87ea467d7938313b291 (patch)
tree4d51af08951ea3c220091fcca6389b1990b960d9
parent2c72388c50aabd13a0015dedce52f50169e16dee (diff)
downloadtimebomb-04beba2aefc66a1230b9d87ea467d7938313b291.tar.gz
timebomb-04beba2aefc66a1230b9d87ea467d7938313b291.tar.bz2
timebomb-04beba2aefc66a1230b9d87ea467d7938313b291.zip
add progressbar
-rw-r--r--.gitignore1
-rw-r--r--timebomb.py10
2 files changed, 8 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d20b64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.pyc
diff --git a/timebomb.py b/timebomb.py
index 49729b3..dc721c3 100644
--- a/timebomb.py
+++ b/timebomb.py
@@ -64,9 +64,13 @@ def sleep(m, s):
+ ' mins and ' + str(s) + ' seconds')
sleep_time_s = s + (m*60)
- for s in range(sleep_time_s):
- pr_m, pr_s = divmod(s, 60)
- print(' {:02d}:{:02d}'.format(pr_m, pr_s), end='\r')
+ pbar_len = 40
+ for x in range(sleep_time_s):
+ pr_m, pr_s = divmod(x, 60)
+ print(' {:02d}:{:02d} '.format(pr_m, pr_s), end='')
+ progress = int(x/sleep_time_s * pbar_len)
+ print('#' * progress + '_' * int(pbar_len-progress), end='')
+ print(' {:02d}:{:02d} '.format(m, s), end='\r')
time.sleep(1)
if __name__ == '__main__':
in each repos: see "about"-tab (if existing) for more details / README.
mailto contact at omeckman dot net
all timestamps in UTC (German winter time: UTC+01:00, summer time: UTC+02:00)
dark theme is a modded version of: https://gist.github.com/Yoplitein/f4b671a2ec70c9e743fa