Threading in Slicer 3d

I am creating a progress bar in slicer. But when using threads slicer is exiting abnormally.


This the runnable I created Screenshot from 2020-10-08 11-04-46
This is the driver code
Screenshot from 2020-10-08 11-04-26

Why is the slicer exiting? Can I know how to create a progress bar in slicer qt that will get progressed on a thread?

Do you need a separate thread? Have you tried slicer.util.createProgressDialog()? You might find these examples helpful: Use progress bar from python

You need to be very careful with threads in vtk and python. Another alternative is to start processes instead. Here’s a prototype implementation that works well.