Skip to content

Instantly share code, notes, and snippets.

@sengstacken
Created August 18, 2021 19:29
Show Gist options
  • Save sengstacken/a6ad14b895dc94d9ce08891c64cce0bf to your computer and use it in GitHub Desktop.
Save sengstacken/a6ad14b895dc94d9ce08891c64cce0bf to your computer and use it in GitHub Desktop.
import time
from tqdm.auto import tqdm
mins = 10
with tqdm(desc="Break Timer", total=mins*60, bar_format="{l_bar}{bar} {elapsed_s:.0f}/{total} seconds") as pbar:
start = time.time()
now = time.time()
prev_now = now
while (now - start) < mins*60:
pbar.update(now - prev_now)
time.sleep(1)
prev_now = now
now = time.time()
pbar.update(time.time() - prev_now)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment