Oscar Branson
6 years ago
Hello,
I'm attempting to implement an action based on sigMouseMoved, but have got
seriously confused about how to access this signal.
*The Project*
I am creating multi-panel plots inside a larger pyqt application. To do
this, I have contained everything within a GraphicsView, which contains a
central GraphicsLayout that contains the plots.
I am using PlotItem to create plots, which I then add to the GraphicsLayout
using addItem.
This is all working fine, and I end up with two plots displayed - let's
call them Plot1 and Plot2.
Now, I want to display the cursor position in a label, so I created a label
and a mouseMoved function to update the label text.
*The problem: I can't work out how to connect sigMouseMoved to my
mouseMoved function.*
Following the documentation and examples, I tried setting up a SignalProxy:
SignalProxy(Plot1.scene().sigMouseMoved, rateLimit=60, slot=mouseMoved)
When I try to run this, I get an AttributeError telling me that 'NoneType'
object has no attribute 'sigMouseMoved'. I can't work out why calling
scene() on my plots returns None!
The only difference I can see from the examples is that I'm manually
creating 'PlotItem' rather than pyqtgraph.plot to create my plots... but as
far as I can tell the .plot function is just a wrapper for creating a
PlotItem.
Any help/pointers would be greatly appreciated... this is driving me mad!
Thanks,
Oscar.
I'm attempting to implement an action based on sigMouseMoved, but have got
seriously confused about how to access this signal.
*The Project*
I am creating multi-panel plots inside a larger pyqt application. To do
this, I have contained everything within a GraphicsView, which contains a
central GraphicsLayout that contains the plots.
I am using PlotItem to create plots, which I then add to the GraphicsLayout
using addItem.
This is all working fine, and I end up with two plots displayed - let's
call them Plot1 and Plot2.
Now, I want to display the cursor position in a label, so I created a label
and a mouseMoved function to update the label text.
*The problem: I can't work out how to connect sigMouseMoved to my
mouseMoved function.*
Following the documentation and examples, I tried setting up a SignalProxy:
SignalProxy(Plot1.scene().sigMouseMoved, rateLimit=60, slot=mouseMoved)
When I try to run this, I get an AttributeError telling me that 'NoneType'
object has no attribute 'sigMouseMoved'. I can't work out why calling
scene() on my plots returns None!
The only difference I can see from the examples is that I'm manually
creating 'PlotItem' rather than pyqtgraph.plot to create my plots... but as
far as I can tell the .plot function is just a wrapper for creating a
PlotItem.
Any help/pointers would be greatly appreciated... this is driving me mad!
Thanks,
Oscar.
--
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 pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/c6f89f64-8ebb-4134-8fb0-1591bb167508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/c6f89f64-8ebb-4134-8fb0-1591bb167508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.