Yep - that solved it. Was trying to make the connection before adding the plots. Doh! Thanks v much.
On Thursday, 18 October 2018 15:14:32 UTC+11, Patrick wrote: > > Hi, > > I don't think the issue is just because you create the PlotItems > separately. If I change the Crosshair/Mouse interaction example lines from > p1 = win.addPlot(row=1, col=0) > p2 = win.addPlot(row=2, col=0) > > to > p1 = pg.PlotItem() > p2 = pg.PlotItem() > win.addItem(p1, row=1, col=0) > win.addItem(p2, row=2, col=0) > > then the example still works fine. > > > I'm taking a guess and saying you're trying to connect the signal to the > PlotItem before adding it to the GraphicsLayout. Until that happens, it > doesn't know what GraphicsScene it's part of. > > > > Patrick > > On Wednesday, 17 October 2018 17:46:03 UTC+10:30, Oscar Branson wrote: >> >> >> 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. >> > -- 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/2bce4a6c-30db-4c39-b5ab-58b481eddfa5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
