Open tamkaho opened 4 years ago
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.
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
The same issue stands using marimo, and the suggested fix works too
It doesn't seem to be showing on Jupyter lab for me. Is there a way to get it to work?