opengl01.py

#!/usr/bin/python3
# ===================================================================
# pip3 install PyOpenGL PyOpenGL_acclerate
# sudo apt-get install python-opengl
#
# Example From: stackabuse.com/
#       brief-introduction-to-opengl-in-python-with-pyopengl/
# ===================================================================

##import OpenGL
from OpenGL.GL   import *
from OpenGL.GLUT import *
from OpenGL.GLU  import *

import sys


print('Imports successful')

def showScreen():
    # remove everything from the screen (i.e.display all white)
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

# initialize a glut instance which allow us to customize our window
glutInit(sys.argv)

# set the display mode to be color
glutInitDisplayMode(GLUT_RGBA)

# set the width and height of your window
glutInitWindowSize(500,500)

# set the position at which this window should appear
glutInitWindowPosition(0,0)

# give your window a title
wind = glutCreateWindow("OpenGL Coding Practice")

# tell OpenGL to call showScreen method continuously
glutDisplayFunc(showScreen)

# draw only graphics or shapes in the showScreen function at all times
glutIdleFunc(showScreen)

# keep the window created above displaying/running in a loop
glutMainLoop()