On 24/04/2022 07.36, Skip Montanaro wrote: > It's not clear there is a straightforward way to catch a signal or get > an event notification when my computer (Dell running XUbuntu 20.04) is > about to sleep or when it's just awakened. The app uses tkinter. Is > there some more-or-less easy way to do this? Mac support would be nice > (I have my eye on a new MacBook one of these days). I suppose bonus > points for something which works on Windows, but that's not a platform > I actually care about.
https://duckduckgo.com/?t=ffab&q=python+up+time pointed-out the "uptime — Cross-platform uptime library" - TLDR; I'm not sure if "uptime" and "boot" relate only to a 'cold-start' or if they include bringing the machine out of 'stand-by' or 'hibernation' https://duckduckgo.com/?t=ffab&q=python+battery+status pointed-out several ideas which require MS-Windows, but apparently the psutil library could be bent to your will: https://www.geeksforgeeks.org/python-script-to-shows-laptop-battery-percentage/ Please let us know how you get on... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list