See https://github.com/napari/napari/blob/main/examples/progress_bar_threading_.py for a minimal example