From: Piotr B. <pio...@gm...> - 2009-09-07 10:46:47
|
> Dears, > I've a problem integrating VPython5 with PyQt4. If anyone can help > me... > thanks a lot! > > > Here is the problem: > > The following code should show a PyQt4 form together with a VPython > scene. > Using VPython3 it works correctly, while useing VPython5 it crashes. > Does anyone has experience on facing this problem? > I would be very grateful if anyone can help me. > > from visual import * > from PyQt4 import QtCore, QtGui > import sys > > class MainWindow(QtGui.QMainWindow): > def __init__(self): > QtGui.QDialog.__init__(self) > > scene.visible = 1 > b = box() > > app = QtGui.QApplication(sys.argv) > window = MainWindow() > window.show() > sys.exit(app.exec_()) > > > replacing > > scene.visible = 1 > > > with > > scene.visible = 0 > > > it works and the Qt window is shown also with VPython5 (but the scene > can't be obviously seen!). Hi Matteo, Recently, I also tried to embed VPython window into QT using PyQT, but also with no luck :( Have you discovered anything new on that matter? Below is my code: from PyQt4 import QtCore, QtGui from visual import * class Ball(QtGui.QGraphicsItem): def __init__(self): super(Ball, self).__init__() self.shape = sphere(pos=(17.047, 14.099, 3.625),radius=1) if __name__ == '__main__': app = QtGui.QApplication(sys.argv) scene_qt = QtGui.QGraphicsScene() scene_qt.setSceneRect(-300, -300, 600, 600) scene_qt.setItemIndexMethod(QtGui.QGraphicsScene.NoIndex) # scene2 = display(title='Graph of position', width=600, height=200, center=(5,0,0), background=(0,1,1)) ball = Ball() scene_qt.addItem(ball) # ball = sphere(pos=(17.047, 14.099, 3.625),radius=1) view = QtGui.QGraphicsView(scene_qt) view.show() sys.exit(app.exec_()) Best, Piotr Byzia |