The following could be a quick and dirty start. It doesn't run very smoothly, because it doesn't make use of threading and callbacks, but for pointing you into one of many directions, it could help.
One thing: python does not come with a fully featured core integrated gui library. You need to use third party apis like tk as I do in the sample. This requires python support for those tk libs on your OS. Make sure it is available by installing it. On debian linux it was
sudo apt-get install python3-tk
Also ensure psutil module is available for your python version. You can add it via pip install psutil
.
So here is the samlpe:
#!/usr/bin/python3
import psutil
from time import sleep
import tkinter as TK
from tkinter import messagebox
PROCNAME = "grep"
root = TK.Tk()
root.withdraw()
while 1:
for proc in psutil.process_iter():
if proc.name() == PROCNAME:
messagebox.showinfo("process running", proc)
sleep(0.1)
After storing the code in a file like "myprog.py", you then run the program from command line: python3 myprog.py
The process name (PROCNAME variable) can be set individually. I was running grep -R *
in another command line. If you do so, the message should pop up.