You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
close this issue if this is actually possible, but I couldnt figure out for the life of me how to include a blank line to seperate the progress bar from the rest of the text streams when wrapping stdout/stderr.
I think that this is an important quality of life feature for a progressbar. See the attached image below for how it looks when installing/removing apt packages.
Apart from this, great library. Simple and reliable.
Edit: I just discovered the init argument "line_offset". However, line_offset = 1 doesn't seem to achieve the desired effect. It seems to suppress any stdout printing at all
I tried it, but with this code I don't see any of the "test text messages" being printed, nor the "Program launched! for that matter. I only see the progress bar.
-> Code (using python 3.10)
import time
import progressbar
progressbar.streams.wrap_stderr()
progressbar.streams.wrap_stdout()
start_val = 0
max_val = 20
print(f'Program launched!')
for k in progressbar.ProgressBar(start_val,max_val, line_offset=1):
print(f'-> test text message')
time.sleep(0.1)
Added the opt-in redirect_blank_line option, which keeps a blank line between redirected stdout/stderr output and the bar. Locked by tests/test_terminal.py::test_redirect_blank_line_position (asserts placement between the clear sequence and the redraw) added in #326. Closing.
Activity
[-]Seperating blank line[/-][+]Missing separating blank line option[/+]Somerandomguy10111 commentedon Apr 29, 2024
Edit: I just discovered the init argument "line_offset". However, line_offset = 1 doesn't seem to achieve the desired effect. It seems to suppress any stdout printing at all
-> ProgressBar(line_offset=0)

-> ProgressBar(line_offset=1)

wolph commentedon Apr 29, 2024
You can try the
line_offsetparameter, it's meant for multiple parallel progress bars but it should work for this: https://progressbar-2.readthedocs.io/en/latest/index.html#showing-multiple-independent-progress-bars-in-parallelSomerandomguy10111 commentedon Apr 29, 2024
I tried it, but with this code I don't see any of the "test text messages" being printed, nor the "Program launched! for that matter. I only see the progress bar.
-> Code (using python 3.10)
-> Output

wolph commentedon May 1, 2024
You're right, it doesn't work right now :)
I've tested a little and I don't think any option does what you need currently.
Address issues #212, #295 and lock in #301
Address issues #212, #295 and lock in #301
wolph commentedon Jul 18, 2026
Added the opt-in
redirect_blank_lineoption, which keeps a blank line between redirected stdout/stderr output and the bar. Locked bytests/test_terminal.py::test_redirect_blank_line_position(asserts placement between the clear sequence and the redraw) added in #326. Closing.Merge pull request #326 from wolph/harden-issue-tests-2