error when clicking on points...

36 views
Skip to first unread message

Jeremy Webster

unread,
Mar 29, 2018, 1:00:05 PM3/29/18
to pyqtgraph
I'm working on making it so when I click on a point, it will show the coordinates...etc

it's crashing when I click on a point with the error:


...python3.6/site-packages/pyqtgraph/graphicsItems/ScatterPlotItem.py", line 817, in pointsAt
s2x = s2y = ss * 0.5
    TypeError: can't multiply sequence by non-int of type 'float'


code snippets...

       
self.my_curve = pg.PlotDataItem(x=self.t, y=self.y,)
       
self.my_curve.sigPointsClicked.connect(self.pointsClicked)
       
self.myPlot.addItem(self.backaz_curve)
       
...


   
def pointsClicked(self):
       
for idx, point in enumerate(points):
           
print('{}: x={}, y={}'.format(idx, point.x(), point.y()))







Jeremy Webster

unread,
Mar 29, 2018, 1:41:11 PM3/29/18
to pyqtgraph
oops, there are a couple of small mis-types in the code above, I simplified it from my own code to make it easier to read...

It should say...

       
self.my_curve = pg.PlotDataItem(x=self.t, y=self.y,)
       
self.my_curve.sigPointsClicked.connect(self.pointsClicked)

       
self.myPlot.addItem(self.my_curve)
       
...


   
def pointsClicked(self, points):
Reply all
Reply to author
Forward
0 new messages