May 2019
Intermediate to advanced
542 pages
13h 37m
English
Our CPU monitor will display real-time CPU activity using an area graph. The graph will be enhanced by a color gradient, which will show higher values in a different color from lower values. The graph will only show a configured number of values at one time, scrolling old values off to the left side of the widget as new ones are added from the right.
To accomplish this, we need to build a custom widget. We'll call it GraphWidget, and begin it as follows:
class GraphWidget(qtw.QWidget): """A widget to display a running graph of information""" crit_color = qtg.QColor(255, 0, 0) # red warn_color = qtg.QColor(255, 255, 0) # yellow good_color = qtg.QColor(0, 255, 0) # green def __init__( self, *args, data_width=20, minimum=0, ...
Read now
Unlock full access