2

I would like to programmatically show a processing algorithm dialog from Python. I gived a look to processing toolbox and I found that this is possible importing and instantiating the class AlgorithmDialog gui/processingToolbox.py

from processing.gui.AlgorithmDialog import AlgorithmDialog
from qgis.core import QgsApplication

alg = QgsApplication.processingRegistry().algorithmById('qgis:extractbyattribute')
dlg = AlgorithmDialog(alg, False, iface.mainWindow())
dlg.show()
dlg.exec_()

This opens algorithm dialog and let me perform processing computations but once closed the dialog window QGIS become unstable and crash without any message interacting with the user interface.

What am I doing wrong? Is there a method to do this in other way?

3

You have another function for doing this:

from processing import execAlgorithmDialog

params = {}  # A dictionary to load some default value in the dialog
execAlgorithmDialog('qgis:extractbyattribute', params)
| improve this answer | |
  • Great. Very handy solution. – Enrico Ferreguti Jan 24 at 23:28
  • the method returns the results dict so you can perform further action like styling renaming etc.. 'results = execAlgorithmDialog('qgis:extractbyattribute', params)' – Enrico Ferreguti Jan 29 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.