How to do it...

As the entire Python code is a little bit long here, we will show just a little bit of the code.

The entire code is available online and this Python module is called wxPython_OpenGL_GUI.py:

import wx                   from wx import glcanvas from OpenGL.GL import * from OpenGL.GLUT import * #--------------------------------------------------- class CanvasBase(glcanvas.GLCanvas):     def __init__(self, parent):         glcanvas.GLCanvas.__init__(self, parent, -1)         self.context = glcanvas.GLContext(self)         self.init = False         # Cube 3D start rotation         self.last_X = self.x = 30         self.last_Y = self.y = 30         self.Bind(wx.EVT_SIZE, self.sizeCallback)         self.Bind(wx.EVT_PAINT, self.paintCallback)         self.Bind(wx.EVT_LEFT_DOWN, self.mouseDownCallback)  self.Bind(wx.EVT_LEFT_UP, ...

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.