1

I am trying to display a vertex marker for a QGIS Python plugin I am writing. I am getting a the following error...

'NameError: global name 'QgsVertexMarker' is not defined'

canv = self.iface.mapCanvas()
canv.setExtent(rect)
marker = QgsVertexMarker(canv)
marker.setCenter(QgsPoint(x,y))
canv.refresh()

What am I doing wrong?

2

You just need to import it from the qgis.gui module

 from qgis.gui import QgsVertexMarker
| improve this answer | |

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.