question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TQDM-style progress bar

See original GitHub issue

Problem

The st.progress API is quite low level:

  • it cannot be composed with iterators
  • it doesn’t automatically compute percentages or time remaining

Solution

MVP

It would be great if we had another primitive that behaved like tqdm, with a similar (or identical?) API.

Possible additions

Should we make a special widget for this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:25
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
Wirgcommented, Dec 3, 2020

I think you may be interested in stqdm :

This takes the best from tqdm & streamlit to :

  • update only when necessary and avoid slowing down your program too much
  • have a progress bar in your frontend and backend
  • add a description and all the tqdm options
  • add the tqdm details to your frontend (% completion, ETA …) demo gif

Upcoming features :

  • better handling of multiple progress bars
  • colors
7reactions
jeremyjordancommented, Sep 24, 2019

The current progress widget, as you mentioned, feels too low level for everyday use. Here’s a minimum implementation that would capture the desirable level of abstraction. The nice thing about tqdm is you can simply wrap the object you’re iterating over and it will figure out how to report progress.

import streamlit as st
import time


class tqdm:
    def __init__(self, iterable, title=None):
        if title:
            st.write(title)
        self.prog_bar = st.progress(0)
        self.iterable = iterable
        self.length = len(iterable)
        self.i = 0

    def __iter__(self):
        for obj in self.iterable:
            yield obj
            self.i += 1
            current_prog = self.i / self.length
            self.prog_bar.progress(current_prog)


for i in tqdm(range(200), title='tqdm style progress bar'):
    time.sleep(0.05)

st.balloons()
Read more comments on GitHub >

github_iconTop Results From Across the Web

tqdm/tqdm: A Fast, Extensible Progress Bar for Python and ...
Instantly make your loops show a smart progress meter - just wrap any iterable with tqdm(iterable) , and you're done! from tqdm import...
Read more >
Python change Tqdm bar style
The last character is the character which it fills when the progress bar has progressed a certain amount like
Read more >
Python | How to make a terminal progress bar using tqdm
You can use the Python external library tqdm, to create simple & hassle-free progress bars which you can add to your code and...
Read more >
How to Use Progress Bars in Python? | tqdm and ...
tqdm is a library in Python which is used for creating Progress Meters or Progress Bars. In this article learn how to create...
Read more >
tqdm documentation
A Fast, Extensible Progress Meter. ... Instantly make your loops show a smart progress meter - just wrap any iterable with tqdm(iterable) ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found