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.
Asked
Active
Viewed 4,057 times
3
-
What do you mean with Gui generated ?, ie you have generated it with Qt Designer and pyuic. – eyllanesc Aug 30 '17 at 16:48
-
I have created a Pyqt5 gui with self written python script and now i want to open a vispy window in one of the frame of the gui. – Abhinav rawat Aug 30 '17 at 17:00
-
yeah i will but can you tell me how to embed this canvas in a frame – Abhinav rawat Aug 30 '17 at 17:11
-
why -1 at this question – Abhinav rawat Sep 25 '17 at 15:55
1 Answers
8
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()

eyllanesc
- 235,170
- 19
- 170
- 241
-
Comments are not for extended discussion or debugging sessions; this conversation has been [moved to chat](http://chat.stackoverflow.com/rooms/153449/discussion-on-answer-by-eyllanesc-how-to-embed-vispy-canvas-in-pyqt5-frame). Please remember to update the answer with all relevant information! – Cody Gray - on strike Sep 01 '17 at 10:15