Skip to content

Commit 2f34074

Browse files
committed
CPU monitor change
1 parent 33605e4 commit 2f34074

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Diff for: CPU Monitor/main.py renamed to CPUmonitor.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self):
3131
self.timer.start(1000)
3232

3333
self.plotWidget.setBackground((240, 240, 240))
34-
self.curve = self.plotWidget.plot(pen="r")
34+
3535

3636
@QtCore.Slot()
3737
def runCPU(self):
@@ -41,6 +41,13 @@ def runCPU(self):
4141
if len(self.data) > self.max:
4242
self.data.pop(0)
4343

44+
if cpu_usage < 50:
45+
self.curve = self.plotWidget.plot(pen="g")
46+
elif cpu_usage < 80:
47+
self.curve = self.plotWidget.plot(pen="o")
48+
else:
49+
self.curve = self.plotWidget.plot(pen="r")
50+
4451
self.curve.setData(self.data)
4552
self.text.setText(f"CPU usage: {cpu_usage}%")
4653

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)