May 2019
Intermediate to advanced
542 pages
13h 37m
English
Let's start our CPU monitor in a new class called CPUUsageView:
class CPUUsageView(qtch.QChartView): num_data_points = 500 chart_title = "CPU Utilization" def __init__(self): super().__init__() chart = qtch.QChart(title=self.chart_title) self.setChart(chart)
Just as we did with our disk usage chart, we're basing this class on QChartView and beginning the constructor by creating a QChart object. We've also defined a title, and, just as we did in Chapter 12, Creating 2D Graphics with QPainter, configured a number of data points to display at one time. We're going to do a lot more points this time, though, so that we can get a more detailed chart.
After creating the chart object, the next step is to create the series ...
Read now
Unlock full access