diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 00000000..7f0d2114 --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,3 @@ +## 2025-03-02 - [CLI Progress Updates] +**Learning:** Terminal output can become cluttered when iterating through multiple loading steps, reducing the clarity of the overall output stream. Using a simple carriage return (`\r`) with `flush=True` creates clean, in-place progress bars that update the same line instead of spamming standard out. +**Action:** When printing loading bars or single-line progress sequences in command-line tools, default to `\r` and ensure the output stream is flushed. \ No newline at end of file diff --git a/simulasyon_11.py b/simulasyon_11.py index 4e07b8b1..ae9bf00a 100644 --- a/simulasyon_11.py +++ b/simulasyon_11.py @@ -35,9 +35,9 @@ class Colors: # ============================================================================== def loading_bar(desc): - print(f"{Colors.CYAN}{desc}...{Colors.ENDC}") + print(f"\r{Colors.CYAN}{desc}...{Colors.ENDC}", end='', flush=True) time.sleep(0.01) - print(f"{Colors.GREEN}[OK]{Colors.ENDC}") + print(f"\r{Colors.CYAN}{desc}... {Colors.GREEN}[OK]{Colors.ENDC}") # ------------------------------------------------------------------------------