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: https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/scatterplotitem.html

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

self.position =gl.GLScatterPlotItem(pos=self.pos)
self.position.sigClicked.connect(self.clicked())        
self.graphtroisd.addItem(self.position)

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:

https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/scatterplotitem.html
https://pyqtgraph.readthedocs.io/en/latest/3dgraphics/glscatterplotitem.html

Notice that in GLScatterPlotItem, no such signal exists.

]