-1

So I would like to make a python program that displays the computers cpu usage in real time. So far I am using the psutil module to find cpu usage but I'm not sure how to represent the output visualy.

import psutil
x=(2)
while x>0:
    cpu = psutil.cpu_percent(interval=1, percpu=False)
    print(cpu)

I was wondering if anyone had any ideas on how i could display the results.

Prof101
  • 59
  • 1
  • 8

1 Answers1

0

tkinter is a simple gui package that comes bundled with python. You could use that.

Or you could sys.stdout.write to print the result without a \n every second or so, with \r at the beginning to bring the character cursor to the beginning of the line. This would make a refreshing single line terminal display.

Jules G.M.
  • 3,624
  • 1
  • 21
  • 35