In this tutorial, We will learn how to build a cross platform python app to monitor CPU and RAM usage using psutil library and tkinter (ttkbootsrap) GUI framework.
First part will be a tutorial on various methods available in the Python psutil Libary for System Monitoring and Logging.
In the Second part we integrate the psutil library with a tkinter (ttkbootstrap) program to display various resource usage using radial meter GUI widgets.
- If you are new to ttkboostrap library, Do check out our tkinter ttkbootstrap Tutorial here.
- Do also check our tutorial on building a meter gui using tkinter ttkbootstrap framework tutorial here.
Source Codes
Things to Install
In this tutorial, We will be using both ttkbootstrap GUI Library and psutil (process and system utilities) library to build our System monitoring and logging Program.
The two libraries are not installed with the Python Installation. You need to install it using the pip installer using the below commands.
Installing ttkbootstrap
pip install ttkbootstrap
Installing psutil
pip install psutil

You can check the installation using pip list command.

What is psutil
psutil is a cross-platform library used for retrieving information on system utilization like
- CPU
- Memory,
- Disks,
- Network, Sensors
etc in Python.
It's especially popular for building system monitoring tools, dashboards, and performance analysis utilities and works on Linux, Windows and macOS operating Systems.
Our App will use the psutil library to get information about CPU and Memory and then display it on a tkinter GUI Window.
Introduction to psutil Methods
The major psutil methods we will be using are the ones related to the CPU and Memory Access and are listed below.
- psutil.cpu_percent() - Returns the percentage of CPU usage
- psutil.cpu_count() - Returns the number of CPU Cores
- psutil.cpu_freq() - Returns the frequency at which CPU operates.
psutil.virtual_memory() - Returns the system’s RAM (physical memory) usage
Tags
- Log in to post comments