I have a simple GUI onto which I am plotting images. I create Widgets
for text outputs and arrays plots, and I would like to add one for 3D visualtion using glumpy
, say to show this example from the glumpy documentation.
What I would like is an "extra" slot on which to have the glumpy output:
I saw for example in this GitHub thread that people were referring to PyQt5 and glumpy integration, but I only see snippets of code and noting that works as a standalone example.
Also, it seems glumpy is already using PyQt5 in the backend (here), but I don't understand this well enough to know if and how I can access it a posteriori?
This is my MWE:
from PyQt5 import QtGui, QtCore
import pyqtgraph as pg
import sys
width = 1000
height = 500
class layout():
def setup(self, window):
self.window = window
self.window.resize(width, height)
self.centralwidget = QtGui.QWidget(self.window)
self.horizontallayout = QtGui.QHBoxLayout(self.centralwidget)
self.window.setCentralWidget(self.centralwidget)
self.dialogue = QtGui.QTextEdit()
self.horizontallayout.addWidget(self.dialogue)
self.plot = pg.GraphicsLayoutWidget(self.window)
self.horizontallayout.addWidget(self.plot)
self.plot1 = self.plot.addPlot(colspan=1)
class Window(pg.Qt.QtGui.QMainWindow, layout):
def __init__(self, shot = None):
super(Window, self).__init__()
self.setup(self)
self.show()
if __name__ == '__main__':
app = pg.Qt.QtGui.QApplication([])
Window()
sys.exit(app.exec_())
You have to get the internal QGLWidget through the "_native_window" attribute. The following example is based on the official example geometry-surface.py .