GLUT Example

# 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():
	glClear(GL_COLOR_BUFFER_BIT)
	glFlush()

def keyboard(key, x, y):
	if key == chr(27):
		sys.exit(0)

glutInit([])
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(200, 200)
glutInitWindowPosition(0,0)
glutCreateWindow(sys.argv[0])
glutDisplayFunc(draw)
glutKeyboardFunc(keyboard)
glutMainLoop()