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

Does it work with jupyter lab? #83

Open
tamkaho opened this issue Jun 11, 2020 · 3 comments
Open

Does it work with jupyter lab? #83

tamkaho opened this issue Jun 11, 2020 · 3 comments

Comments

@tamkaho
Copy link

tamkaho commented Jun 11, 2020

It doesn't seem to be showing on Jupyter lab for me. Is there a way to get it to work?

@zhaowb
Copy link

zhaowb commented Jul 19, 2020

Need to skip check_tty, also skip hide_cursor so not to print esc commands:
example:

from progress.bar import Bar
with Bar(message='Prog', max=20, check_tty=False, hide_cursor=False) as bar:
    for _ in range(20):
        time.sleep(1)
        bar.next()
    bar.finish()  # prints an empty line, not necessary

Update: without hide_cursor=False there is no visible difference on screen but from source code it prints esc commands which are not necessary in Jupyter.

@zhaowb
Copy link

zhaowb commented Oct 3, 2020

Also jupyter seems need a chance to get '\r' right (got hint here)
So use in jupyter better use a time.sleep(0) to let jupyter render '\r' right.
Otherwise the output may corrupt for long runs.

Update: Sorry this doesn't really work. It might help in shorter runs, but in long runs (191783 in my test, update() every time) it's still ugly.

from progress.bar import Bar
with Bar(message='Prog', max=20, check_tty=False, hide_cursor=False) as bar:
    for _ in range(20):
        time.sleep(1)
        bar.next()
        time.sleep(0)   # <<< add this
    bar.finish()  # prints an empty line, not necessary

@visika
Copy link

visika commented Aug 8, 2024

The same issue stands using marimo, and the suggested fix works too

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

3 participants