Still working on this issue if anyone has tried to remotely plot the crosshair example.
On Friday, December 8, 2017 at 11:10:53 AM UTC-5, Geoffrey Barrett wrote: > > Hello, > > I am trying to do something similar to the *crosshair.py* example but > with *RemoteGraphicsView.* > > Hypothetically if I have something similar to this: > > from PyQt4 import QtGui, QtCore > import numpy as np > import pyqtgraph as pg > import pyqtgraph.widgets.RemoteGraphicsView > import sys > > class main_window(QtGui.QWidget): > """class that will serve as main window""" > def __init__(self): > super(main_window, self).__init__() > > # view 1 > > self.view1 = pg.widgets.RemoteGraphicsView.RemoteGraphicsView() > self.plot1 = self.view1.pg.PlotItem() > self.view1.setCentralItem(self.plot1) > > # view 2 > self.view2 = pg.widgets.RemoteGraphicsView.RemoteGraphicsView() > self.plot2 = self.view2.pg.PlotItem() > self.view2.setCentralItem(self.plot2) > > > > # add Layout to widget > > layout = QtGui.QVBoxLayout() > > layout.addWidget(self.view1) > layout.addWidget(self.view2) > > self.setLayout(layout) > > self.show() > > self.plot() > > def plot(self): > > """Plot random stuff for test""" > > t = np.arange(10000)/500 > > data = np.random.rand(1, len(t)) > > self.plot1.plot(t, data.flatten()) > self.plot2.plot(t, data.flatten()) > > > # add linear region item > # self.lr = pg.LinearRegionItem() # this doesn't work it seems > # self.plot1.addItem(self.lr) > # RuntimeError: super-class __init__() of type InfiniteLine was never > called > > self.lr = self.view2.pg.LinearRegionItem() # this appears to work > self.plot2.addItem(self.lr) > > self.lr_proxy = pg.multiprocess.proxy(self.update_view1, > callSync='off', autoProxy=True) > self.lr.sigRegionChanged.connect(self.lr_proxy) > > > > def update_view1(self): > # This doesn't appear to be called at all > minX, maxX, = self.lr.getRegion() > self.view2.vb.setXRange(minX, maxX) > > def run(): > > app = pg.mkQApp() > win = main_window() > sys.exit(app.exec_()) > > > if __name__ == '__main__': > run() > > > When you move the linear region nothing happens so there's something > wrong. I used a proxy to connect the update_view1 slot to the > sigRegionChanged signal because I was getting a pickling error otherwise. > Any advice would be appreciated. > > -Geoff > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/0eeeef76-4cd4-4967-855e-20c521b5875c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.