Hello!
I'm having some problems. I would like to print PlotCurveItem name when I click it, but with the methods I tried I get name as soon as mouse enters bounding box of the PlotCurveItem. What am I doing wrong?
I do plots by using:
class CustomPlotCurveItem(pg.PlotCurveItem):
pltClicked = pqc.Signal()
def __init__(self, parent = None, *args, **kwargs):
super(CustomPlotCurveItem, self).__init__(parent, *args, **kwargs)
def mousePressEvent(self, ev):
super(CustomPlotCurveItem, self).mousePressEvent(ev)
self.pltClicked.emit()
And in window:
def do_connections:
items=self.plot_area.items
for item in items:
if isinstance(item,pg.PlotCurveItem):
self.connect(item, pqc.SIGNAL("pltClicked()"), functools.partial(self.plot_item_clicked, item))
def plot_item_clicked(self,item):
print(
item.name())
How can I print the name only when the mouse cursor is directly under over line itself and not over bounding box?
Thank your for the help.