Skip to content

[view source]

Tkinter GUI progressbar decorator for iterators.


>>> from import trange, tqdm
>>> for i in trange(10):
...     ...

tqdm_tk Objects#

[view source]

class tqdm_tk(std_tqdm)

Experimental Tkinter GUI version of tqdm!

Note: Window interactivity suffers if tqdm_tk is not running within a Tkinter mainloop and values are generated infrequently. In this case, consider calling tqdm_tk.refresh() frequently in the Tk thread.


[view source]

def __init__(*args, **kwargs)

This class accepts the following parameters in addition to the parameters accepted by tqdm.


  • grab: bool, optional
    Grab the input across all windows of the process.
  • tk_parent: tkinter.Wm, optional
    Parent Tk window.
  • cancel_callback: Callable, optional
    Create a cancel button and set cancel_callback to be called when the cancel or window close button is clicked.


[view source]

def cancel()

cancel_callback() followed by close() when close/cancel buttons clicked.


[view source]

def reset(total=None)

Resets to 0 iterations for repeated use.


  • total: int or float, optional. Total to use for the new bar.


[view source]

def ttkrange(*args, **kwargs)

A shortcut for*args), **kwargs). On Python3+, range is used instead of xrange.