python – How to use signal in PyQt5 ScatterPlot – Code Utility


I’m trying to make a point cloud in which I click on a point and it returns me the position, x, y, z of that point.

And as we can see in the documentation, there is a signal to perform this action:

I therefore wrote the following code, knowing that I already had my point cloud beforehand.

self.position =gl.GLScatterPlotItem(pos=self.pos)

With an additionnal fonction:

def clicked(self, points):
    print("points : " + points)

However I run into the following error:

AttributeError: 'GLScatterPlotItem' object has no attribute 'sigClicked'


GLScatterPlotItem and ScatterPlotItem are different classes altogether. Looks like you’re trying to use a signal from ScatterPlotItem with a GLScatterPlotItem object.

See the documentation differences here:

Notice that in GLScatterPlotItem, no such signal exists.