Hello,
I am using pg.LinearRegionItem to select an area on the plot.
Once I have selected the area I have set up a mouse event, that when left
button is clicked the region borders will be displayed using pg.TextItem.
However, I want to be able to replace the pg.TextItem is the
LinearRegionItem is changed and a new mouse click is detected
win = pg.GraphicsWindow()
pl = win.addPlot(row=1, col=0)
pl.plot(my_data)
lr = pg.LinearRegionItem(orientation=pg.LinearRegionItem.Horizontal)
pl.addItem(lr)
def on_click(ev):
if (ev.button() == QtCore.Qt.LeftButton):
lo,hi = lr.getRegion()
print (lo,hi)
ti = pg.TextItem('', anchor=(0,1.1), color=(146, 146, 146), fill='w')
pl.addItem(ti)
ti.setText(str(round(lo,3))+ ' ' + str(round(hi,3)))
ev.accept()
pl.vb.mouseClickEvent = on_click
Any help would be appreciated!
Greydon
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/4347f9fc-b02f-4dee-b287-67df46a38ac2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.