Tuesday 24 November 2015

qgis - How to iterate over features and abort iteration with keypress in PyQGIS?


I would like to run a loop with PyQGIS, it should wait for the user to press a key either SpaceBar or Escape to continue.


canvas = qgis.utils.iface.mapCanvas()
aLayer = canvas.currentLayer()

feat = QgsFeature()

iter = aLayer.getFeatures()

while iter.nextFeature(feat):
aLayer.removeSelection()
aLayer.select(feat.id())
qgis.utils.iface.actionZoomToSelected().trigger()



How can I do that?





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...