How to embed vispy canvas in PyQt5 frame

4.1k views Asked by At

Hey I want to embed the output window of vispy canvas in my pyqt5 generated Gui. I don't know much about vispy so please help thanks in advance.

1

There are 1 answers

1
eyllanesc On BEST ANSWER

As long as vispy is using Qt as backend, you must use .native, this parameter will make the canvas use QGLWidget, for example:

from PyQt5.QtWidgets import *
import vispy.app
import sys

canvas = vispy.app.Canvas()
w = QMainWindow()
widget = QWidget()
w.setCentralWidget(widget)
widget.setLayout(QVBoxLayout())
widget.layout().addWidget(canvas.native)
widget.layout().addWidget(QPushButton())
w.show()
vispy.app.run()