Returning mouse cursor coordinates in PyQtGraph

后端 未结 1 1092
星月不相逢
星月不相逢 2020-12-30 13:18

I am new to PyQtGraph and want to use it for a speedy visualization of my data acquisition. Previously I was using matplotlib where redrawing the figure was my bottleneck. A

相关标签:
1条回答
  • 2020-12-30 13:22

    You need to setup a pyqtgraph.SignalProxy and connect it to a callback:

    if p is your plot, it'll look like: pyqtgraph.SignalProxy(p.scene().sigMouseMoved, rateLimit=60, slot=callback)

    Whenever the mouse is moved over the plot, the callback is called with an event as an argument, i.e. callback(event). event[0] holds a positional argument you pass to p.vb.mapSceneToView(position).x() for x value and p.vb.mapSceneToView(position).y() for y value.

    0 讨论(0)
提交回复
热议问题