I created a python script to call some API. I want to be informed when it's finished. Is there a way to prevent me from checking the status in the terminal constantly? For example, Can python make the terminal blink or something when it's done?
Asked
Active
Viewed 141 times
1
-
2You can play a tone when it's done https://stackoverflow.com/questions/6537481/python-making-a-beep-noise – alec_djinn Oct 09 '22 at 18:14
-
1So do you mean flashing the tile within the windows taskbar? If so you'd need to look at a package such as `wincom` - Alternatively (or something) have you considered a simple beep tone? https://docs.python.org/3/library/winsound.html – Glycerine Oct 09 '22 at 18:14
-
also great idea! thank you, I think the print('\a') beep is genial – kay Oct 09 '22 at 20:42
1 Answers
2
There is a way to flash the tray icon in Windows, and a different way to do it in Linux/Mac, but I'm not aware of an os-agnostic way of doing that.
You can pop up a window using TkInter, though. TkInter comes with Python.
from tkinter import messagebox
messagebox.showinfo(title="Done", message="Dust! This task is done.")

Ian Moote
- 851
- 8
- 15
-
1thanks bro, my script is running in the WSL2. I just tested with your sugguestion, it worked, but the script will be frozen for ca. 20-30s waiting for the WSL response – kay Oct 09 '22 at 20:03
-
Huh! That's interesting. I don't run Windows here, but maybe I'll throw something together just to check that out. – Ian Moote Oct 10 '22 at 01:37