Skip to content

tqdm.tk#

[view source]

Tkinter GUI progressbar decorator for iterators.

Usage:

>>> from tqdm.tk 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.

__init__#

[view source]

def __init__(*args, **kwargs)

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

Parameters

  • 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.

cancel#

[view source]

def cancel()

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

reset#

[view source]

def reset(total=None)

Resets to 0 iterations for repeated use.

Parameters

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

ttkrange#

[view source]

def ttkrange(*args, **kwargs)

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