How to do it...

First, we import several packages from OpenGL.  In the main() Python function, we initialize the GL Utility (glut) library. Then we choose a single buffer (as opposed to double buffering) and also select the Red, Green, Blue, Alpha (RGBA) color mode.

We then create a window via GLUT. No need for tkinter, wxPython or PyGLet. We can do this directly via OpenGL GLUT functions.

In Python 3.6, we have to pass in the string of the window title as bytes. We do this by placing a b in front of the string, which encodes the string as bytes.

After this, we create and define a display function, RenderScene(). This function gets called when we start the glut windows event loop. 

In the SetupRC() function, we define a color to be used for ...

Get Python GUI Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.