Progressbar in 3D Slicer python script - how can I make it stay in foreground?


How can I make the progressbar created like this

    progressbar = slicer.util.createProgressDialog(windowTitle='Processing...', autoClose=False)
    progress =0
    steps = 7
    progressStep = 100/steps       
    # Update progress value
    progress += progressStep
    # Update label text
    progressbar.labelText = "Starting processing ..."

. . .

stay in foreground? It is called from the process logic of my extension and keeps disappearing from the screen (Slicer switches itself to foreground) , from time to time

Thank you and best regards


In general, it is better to avoid popup windows and instead place all widgets in the module widget (and disable parts of the GUI that you want to prevent from being manipulated). If you want to use a popup window then set the application’s main window as parent to make sure it always appears above the main window.

1 Like

Thank you.
This works for me now:

1 Like