Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing separating blank line option #295

Open
Somerandomguy10111 opened this issue Apr 29, 2024 · 4 comments
Open

Missing separating blank line option #295

Somerandomguy10111 opened this issue Apr 29, 2024 · 4 comments
Labels

Comments

@Somerandomguy10111
Copy link

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.

image

Apart from this, great library. Simple and reliable.

@Somerandomguy10111 Somerandomguy10111 changed the title Seperating blank line Missing separating blank line option Apr 29, 2024
@Somerandomguy10111
Copy link
Author

Somerandomguy10111 commented 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)
image

-> ProgressBar(line_offset=1)
image

@wolph
Copy link
Owner

wolph commented Apr 29, 2024

You can try the line_offset parameter, 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-parallel

@Somerandomguy10111
Copy link
Author

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)

-> Output
image

@wolph
Copy link
Owner

wolph commented 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.

@github-actions github-actions bot added the Stale label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants