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

Hi,

How can I make the progressbar created like this

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

. . .

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

Rudolf

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:

progressbar=slicer.util.createProgressDialog(parent=slicer.util.mainWindow(),windowTitle='Processing...',autoClose=False)
1 Like