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

Is there a way to place progress bar always at the bottom? #280

Closed
jpmvferreira opened this issue Oct 4, 2023 · 2 comments
Closed

Is there a way to place progress bar always at the bottom? #280

jpmvferreira opened this issue Oct 4, 2023 · 2 comments

Comments

@jpmvferreira
Copy link

jpmvferreira commented Oct 4, 2023

I would like to ask if there is a way to ensure that the progress bar would be located always at the end of the text, even if some output is being printed to the terminal.

To provide a visual example, I wanted my progress bar to look something like this
image
Where you can see the progress at the bottom of the terminal (or at the end of the text, would work either way) and if anything is printed to STDOUT/STDERR, it would not be cluttered by outdated versions of the progress bar, i.e.
image

I would also to state that, once I add the showvalues optional argument in next!, all of my printing is gone as the output is cleared to ensure that the progress bar remains in-place.

@jpmvferreira jpmvferreira changed the title Place progress bar always at the bottom Is there a way to place progress bar always at the bottom? Oct 4, 2023
@MarcMush
Copy link
Collaborator

Using offset=1 and clearing manually lines with "\u1b[K":

using ProgressMeter
p = Progress(50; offset=1)

for i in 1:50
   for _ in 1:rand(0:2)
       println(i, "\u1b[K")
   end
   print("\u1b[K")
   next!(p; showvalues=("i"=>i,))
   sleep(0.11)
end

It doesn't work in a notebook though, since offsets are broken with IJulia (#238)

@jpmvferreira
Copy link
Author

Amazing, this is just what I wanted, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants