From cdc57a102c2adf30fa37db14c424dc5a59b4c238 Mon Sep 17 00:00:00 2001 From: Ziad Arafat Date: Mon, 5 Dec 2022 12:35:13 -0700 Subject: [PATCH] Changed percent output to progress bar --- mealman.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mealman.py b/mealman.py index 30af1df..8dd9100 100755 --- a/mealman.py +++ b/mealman.py @@ -4,6 +4,7 @@ import sys from pathlib import Path import csv from datetime import datetime +from tqdm import tqdm def extract_calories(first_row): if first_row[0] != "zigzag": @@ -52,4 +53,9 @@ if __name__ == "__main__": print("Calories Allowed Today:", int(max_calories)) print("Calories In Plan:", int(calories_in_plan)) print("Excess calories: ", int(calories_in_plan - max_calories)) - print("Percentage of calories in plan:", int(calories_in_plan / max_calories * 100)) + with tqdm(total=100, + desc="Percent of Calories", + leave=True, + ncols=80, + bar_format='{l_bar}{bar}|',) as pbar: + pbar.update(int(calories_in_plan / max_calories * 100)) \ No newline at end of file