I receive API data every 5 minutes and run a Python code to check if the incoming data fulfills certain conditions. The data is in JSON format, but I convert it to a data frame and perform my checks there. In case one of the checks generates a hit, I'd like to get notified. I'd like to find a fast and resource-preserving way for Python to notify me.
What would be the most efficient (minimalistic) code to generate a window (preferably one with an audio sound when it appears) with one line of text, e.g. "Condition1/2/3/4 fulfilled, timestamp, string"
Thank you for your kind help
Use messagebox
could be very easy.A minimal example:
from tkinter import messagebox
import time
import tkinter as tk
root = tk.Tk()
info = "what"
root.withdraw()
if condition:
messagebox.showinfo("title",f"Condition-1 fulfilled time:{time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime())} \n info:{info}")
if condition is True
,it will show a small window(it will play the default system sound,and no need to use winsound.Beep()
).