To see how OpenGL works with PyQt, we're going to use our shaders to make a simple OpenGL image, which we will be able to control through a PyQt interface. Create a copy of your Qt application template from Chapter 4, Building Applications with QMainWindow, and call it wedge_animation.py. Put this in the same directory as your shader files.
Then, start by adding this code in MainWindow.__init__():
self.resize(800, 600)
main = qtw.QWidget()
self.setCentralWidget(main)
main.setLayout(qtw.QVBoxLayout())
oglw = GlWidget()
main.layout().addWidget(oglw)
This code creates our central widget and adds a GlWidget object to it. The GlWidget class is what we'll be creating to display our OpenGL drawing. To create it, we'll need to subclass a widget that can display OpenGL content.
...