+ def OnMouseMotion(self, evt):
+ if evt.Dragging() and evt.LeftIsDown():
+ self.x, self.y = self.lastx, self.lasty
+ self.x, self.y = evt.GetPosition()
+ self.Refresh(false)
+
+
+
+
+ class CubeCanvas(MyCanvasBase):
+ def InitGL(self):
+ # set viewing projection
+ glMatrixMode(GL_PROJECTION);
+ glFrustum(-0.5, 0.5, -0.5, 0.5, 1.0, 3.0);
+
+ # position viewer
+ glMatrixMode(GL_MODELVIEW);
+ glTranslatef(0.0, 0.0, -2.0);
+
+ # position object
+ glRotatef(self.y, 1.0, 0.0, 0.0);
+ glRotatef(self.x, 0.0, 1.0, 0.0);
+
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+
+ def OnDraw(self):