diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 00000000..3dcdc92f --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,3 @@ +## 2025-05-15 - Dynamic Loading Bar +**Learning:** Terminal-based "simulations" benefit greatly from small visual feedback cues like progress bars. +**Action:** Always check if a script uses `time.sleep` with static text and consider replacing it with a progress indicator for better user feedback. diff --git a/simulasyon_11.py b/simulasyon_11.py index 63f8da57..03f08e58 100644 --- a/simulasyon_11.py +++ b/simulasyon_11.py @@ -35,9 +35,14 @@ class Colors: # ============================================================================== def loading_bar(desc): - print(f"{Colors.CYAN}{desc}...{Colors.ENDC}") - time.sleep(0.01) - print(f"{Colors.GREEN}[OK]{Colors.ENDC}") + print(f"{Colors.CYAN}{desc}{Colors.ENDC}") + total = 20 + for i in range(total + 1): + time.sleep(0.02) + percent = int(100 * (i / total)) + bar = '█' * i + '-' * (total - i) + print(f"\r{Colors.CYAN}|{bar}| {percent}%{Colors.ENDC}", end="", flush=True) + print(f" {Colors.GREEN}[OK]{Colors.ENDC}") # ------------------------------------------------------------------------------