Please, can you tell me what is the difference between qgis.utils and qgis.core ?

I'd like to understand step by step the QGIS API Document.


qgis.utils is a set of utilities used by the application to do Python based things. Some of these things are setting up plugins, adding Python error handling, etc.

qgis.core is the main core library for QGIS. This holds most of the non ui based objects that you can use to build a plugin or standalone application. This library holds things like layers (QgsMapLayer, QgsVectorLayer), layer registry (QgsMapLayerRegistry), geometry objects (QgsGeometry), feature objects (QgsFeature).

qgis.gui is the main UI core library. This holds most of the reusable dialogs, widgets, etc that you can use to build an interface using the QGIS libraries. This is where you will find things like QgsMapCanvas because it is a UI object it lives here.

Note: If you are making a standalone application based on QGIS you should avoid using qgis.utils as it's mostly tried to the application itself and not normally used standalone.

  • Thank you Nathan. If I use QtDesigner for designing my widget, and after compile my Form.ui in order to have Form.py. I guess it's not necessary to import qgis.gui in my file callForm.py !!!!! I will have only in the hearder : from qgis.utils import *, import qgis.core. Am I said well ? – Tchotcho Aug 20 '15 at 0:24

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.