I am trying to recreate the mouse movement slot from the "Crosshair / Mouse 
Interaction" example using addViewBox instead of addPlot, but it doesn't 
seem to be mapping the position -> line correctly.  Has anyone tried this?

Here is the code

```
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from pyqtgraph.Point import Point


app = QtGui.QApplication([])
win = pg.GraphicsWindow()

win.setWindowTitle('pyqtgraph example: crosshair')
label = pg.LabelItem('NICK', justify='center')
win.addItem(label)

p1 = win.addViewBox(row=1, col=0)
image = pg.ImageItem(np.random.randn(50,50))
p1.addItem(image)

vLine = pg.InfiniteLine(angle=90, movable=False)
hLine = pg.InfiniteLine(angle=0, movable=False)
p1.addItem(vLine, ignoreBounds=True)
p1.addItem(hLine, ignoreBounds=True)

def mouseMoved(evt):
pos = evt[0]
if p1.sceneBoundingRect().contains(pos):
mousePoint = p1.mapSceneToView(pos)
vLine.setPos(pos.x())
hLine.setPos(pos.y())
proxy = pg.SignalProxy(p1.scene().sigMouseMoved, rateLimit=60, 
slot=mouseMoved)
```

-- 
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/ca6fa68f-c9c2-4ad9-9551-c66facea805d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to