Wednesday 5 June 2019

pyqgis - How do I fix "name 'iface' is not defined"?



i try to export a map but at the end of my process I always get the following message: "name 'iface' is not defined".


What is wrong with my script?


I am working with QGIS 2.18.12


from PyQt4.QtGui import QColor, QImage, QPainter
from qgis.core import QgsExpression, QgsStatisticalSummary, QgsSymbolV2, QgsDataDefined, QgsRuleBasedRendererV2, QgsMarkerSymbolV2
from PyQt4.QtCore import Qsize


...

map_settings = iface.mapCanvas().mapSettings()
c = QgsComposition(map_settings)
c.setPaperSize(400,160)
c.setPrintResolution(dpi)

...


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...