# Minimal program to open & clear a window. # This program is intended to introduce GLUT. import sys from OpenGL.GLUT import * from OpenGL.GL import * from OpenGL.GLU import * def draw(): print "redraw" glClear(GL_COLOR_BUFFER_BIT) glFlush() def keyboard(key, x, y): if key == 'q': sys.exit(0) elif key == ' ': print 'Mouse is at', x, y glutInit([]) glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) glutInitWindowSize(200, 200) glutInitWindowPosition(0,0) glutCreateWindow(sys.argv[0]) glutDisplayFunc(draw) glutKeyboardFunc(keyboard) glutMainLoop()