pip install visvis
python
import visvis as vv
import numpy as np
f = vv.figure()
a = vv.gca()
a.axis.axisColor = 0, 0, 0
a.axis.visible = True
a.cameraType = '2d'
vertices = np.array([[1, 1, 2], [1, -1, 2], [-1, -1, 2], [-1, 1, 2], [1, 1, 0], [1, -1, 0], [-1, -1, 0], [-1, 1, 0]])
faces = np.array([[0, 1, 2, 3], [4, 5, 6, 7]])
cube = vv.mesh(vertices[faces[0]], faces=[range(4)])
sphere = vv.solidSphere((0, 0, 1), 1)
cube.faceColor = (0.2, 0.2, 1)
cube.edgeColor = (0, 0, 0)
sphere.faceColor = (1, 0, 0)
a.scene.objects.append(cube)
a.scene.objects.append(sphere)
@vv.processEvents
def rotate(event):
a.Rotate(1, 0, 0)
a.Rotate(0, 1, 0)
a.DrawNow()
vv.use()
rotate()