Search code examples
pythonloopspycharmstatusbartqdm

Python tqdm package - how to configure for less frequent status bar updates


I'm using a tqdm package (v4.19.5) for a loop with 200K+ iterations in Python 3.6 (Anaconda 3, Windows 10 x64, PyCharm IDE). It prints the status bar too frequently, so that my earlier history disappears in the console.

Is there a way to limit the frequency of status bar updates? I can't seem to find this solution online or tqdm website.

Currently, my status bar prints like this. Ideally, I'd like to set put a cap on percentage change. For example, update it not more frequently than once per 1% change/progress.

enter image description here


Solution

  • You can use miniters parameter i have it from source code https://github.com/tqdm/tqdm/blob/master/tqdm/_tqdm.py

    tqdm.tqdm(iterable, miniters=int(223265/100))