QPainter is not merely a specialized tool for drawing on images; it's actually the workhorse that draws all the graphics for all the widgets in Qt. In other words, every pixel of every widget you see in your PyQt application was drawn by a QPainter object. We can take control of QPainter to create a purely custom widget.
To explore this idea, let's create a CPU monitor application. Get a fresh copy of the Qt application template and call it cpu_graph.py, and then we'll begin.