Ejemplo n.º 1
0
                           self.camera.getY() - 1, self.camera.getZ())


if __name__ == "__main__":
    world = PandaTest()
    app = QApplication(sys.argv)
    appw = QMainWindow()
    appw.setGeometry(50, 50, 1024, 768)
    # Here, we create the panda3D widget and specify that we want the widget to stretch
    # The keep_ratio parameter tells weather the painter should keep the ratio of the original
    # environment or it can devorm it. If ratio is kept, then the original will be cropped
    main_widget = QWidget()
    main_widget.setLayout(QVBoxLayout())

    # SPanda3D Widget
    pandaWidget = QPanda3DWidget(world)  #, stretch=True, keep_ratio=False)
    # Buttons Widget
    btn_widget = QWidget()
    btn_widget.setMaximumHeight(50)
    btn_widget.setLayout(QHBoxLayout())
    # Add them to the window
    main_widget.layout().addWidget(pandaWidget)
    main_widget.layout().addWidget(btn_widget)
    # Now let's create some buttons
    le_key_evt = QLineEdit("")
    btn_widget.layout().addWidget(le_key_evt)

    appw.setCentralWidget(main_widget)
    appw.show()
    sys.exit(app.exec_())
Ejemplo n.º 2
0
class PandaTest(Panda3DWorld):
    """
    This is the class that defines our world
    It inherits from Panda3DWorld that inherits from 
    Panda3D's ShowBase class
    """
    def __init__(self):
        Panda3DWorld.__init__(self)
        self.cam.setPos(0, -28, 6)
        self.win.setClearColorActive(True)
        self.win.setClearColor(VBase4(0, 0.5, 0, 1))        
        self.testModel = loader.loadModel('panda')
        self.testModel.reparentTo(render)

        # This rotates the actor 180 degrees on heading and 90 degrees on pitch.
        myInterval4 = self.testModel.hprInterval(1.0, Vec3(360, 0, 0))
        myInterval4.loop()

if __name__ == "__main__":    
    world = PandaTest() 
    
    app = QApplication(sys.argv)
    appw=QMainWindow()
    appw.setGeometry(50, 50, 800, 600)

    pandaWidget = QPanda3DWidget(world)
    appw.setCentralWidget(pandaWidget)
    appw.show()
    
    sys.exit(app.exec_())