Gregory Bättig
2018-09-13 10:03:36 UTC
I have a QT application where I use the GraphicsView in combination with
GraphicsLayout. I took the example "GraphicsLayout.py" from the PyQtGraph
repository as a starting point. The below code snippet shows from where I
started out.
app = QtGui.QApplication([])
view = pg.GraphicsView()
l = pg.GraphicsLayout(border=(100,100,100))
view.setCentralItem(l)
view.show()
view.setWindowTitle('pyqtgraph example: GraphicsLayout')
view.resize(800,600)
p1 = l.addPlot(title="Plot 1")
p2 = l.addPlot(title="Plot 2")
vb = l.addViewBox(lockAspect=True)
img = pg.ImageItem(np.random.normal(size=(100,100)))
vb.addItem(img)
This approach works fine but I now would like to add an ImageView instead
of an ImageItem to the layout. Mainly because I want to take advantage of
the histogram and slider functionalities already inbuilt in ImageView
objects.
In the example "DataSlicing" they add ImageView objects to a layout, but
there it is a QtGui.QtGridLayout object and the ImageViews are added as
widgets and not as items.
cw = QtGui.QWidget()
win.setCentralWidget(cw)
l = QtGui.QGridLayout()
cw.setLayout(l)
imv1 = pg.ImageView()
imv2 = pg.ImageView()
l.addWidget(imv1, 0, 0)
l.addWidget(imv2, 1, 0)
Is there a way to combine these two approaches, by adding ImageView objects
to a pg.GraphicsLayout, or is that not the right way to go?
Thanks for any kind of advice
GraphicsLayout. I took the example "GraphicsLayout.py" from the PyQtGraph
repository as a starting point. The below code snippet shows from where I
started out.
app = QtGui.QApplication([])
view = pg.GraphicsView()
l = pg.GraphicsLayout(border=(100,100,100))
view.setCentralItem(l)
view.show()
view.setWindowTitle('pyqtgraph example: GraphicsLayout')
view.resize(800,600)
p1 = l.addPlot(title="Plot 1")
p2 = l.addPlot(title="Plot 2")
vb = l.addViewBox(lockAspect=True)
img = pg.ImageItem(np.random.normal(size=(100,100)))
vb.addItem(img)
This approach works fine but I now would like to add an ImageView instead
of an ImageItem to the layout. Mainly because I want to take advantage of
the histogram and slider functionalities already inbuilt in ImageView
objects.
In the example "DataSlicing" they add ImageView objects to a layout, but
there it is a QtGui.QtGridLayout object and the ImageViews are added as
widgets and not as items.
cw = QtGui.QWidget()
win.setCentralWidget(cw)
l = QtGui.QGridLayout()
cw.setLayout(l)
imv1 = pg.ImageView()
imv2 = pg.ImageView()
l.addWidget(imv1, 0, 0)
l.addWidget(imv2, 1, 0)
Is there a way to combine these two approaches, by adding ImageView objects
to a pg.GraphicsLayout, or is that not the right way to go?
Thanks for any kind of advice
--
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/5f47ca47-69dc-40dc-a6f6-de4a37e9517d%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/5f47ca47-69dc-40dc-a6f6-de4a37e9517d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.