Closed bridgerdier closed 2 years ago
Added parameter to override tqdm to allow using p_tqdm with GUI progress bars.
p_tqdm
tqdm flavors exist for tkinter and matplotlib, the following template could be used to feed progress bar values to any GUI toolkit:
class TqdmWrapper(tqdm.tqdm): def __init__(self, iterable, **kwargs): super().__init__(iterable=iterable, **kwargs) def display(self, msg=None, pos=None): print(self.format_dict) # do something with self.format_dict['n']
Example for using with p_imap: iterator = p_tqdm.p_imap(add, ['1', '2', '3'], ['a', 'b', 'c'], tqdm=TqdmWrapper)
iterator = p_tqdm.p_imap(add, ['1', '2', '3'], ['a', 'b', 'c'], tqdm=TqdmWrapper)
This looks great, thank you @bridgerdier!
Added parameter to override tqdm to allow using
p_tqdm
with GUI progress bars.tqdm flavors exist for tkinter and matplotlib, the following template could be used to feed progress bar values to any GUI toolkit:
Example for using with p_imap:
iterator = p_tqdm.p_imap(add, ['1', '2', '3'], ['a', 'b', 'c'], tqdm=TqdmWrapper)