3

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.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Abhinav rawat
  • 111
  • 2
  • 13

1 Answers1

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