From QGIS 3 Plugin Tutorial I need the example for getting a point geometry from clicking at the map.

So I have a file point_tool.py:

from qgis.gui import QgsMapTool, QgsMapToolEmitPoint
from PyQt5.QtCore import pyqtSignal

class PointTool(QgsMapToolEmitPoint): 
    canvasClicked = pyqtSignal('QgsPointXY')
    def __init__(self, canvas):
        super(self, QgsMapTool).__init__(self, canvas)

    def canvasReleaseEvent(self, event):
        point_canvas_crs = event.mapPoint()


And in my plugin:

from .point_tool import PointTool

def addFachdatum(self):
   self.mapTool = PointTool(self.iface.mapCanvas())
def onMapClick(point):
   logging.warning('onMapClick: '+point.asWkt())  

But in QGIS I get the following error:

2021-11-18T12:21:46     WARNING    Traceback (most recent call last):
File "C:/Users/sschmidt/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gga_importer\gga_importer.py", line 420, in addFachdatum
    self.mapTool = PointTool(self.iface.mapCanvas())
File "C:/Users/sschmidt/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gga_importer\point_tool.py", line 9, in __init__
    super(self, QgsMapTool).__init__(self, canvas)
TypeError: super() argument 1 must be type, not PointTool

But I don't understand the problem, because it is Python37 and PointTool is derived from QgsMapToolEmitPoint and this is QObject. Who can help please?

1 Answer 1



super(self, QgsMapTool).__init__(self, canvas)


super(QgsMapTool, self).__init__(canvas)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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