is there any way to disable a loop when the user is inactive / when the screen saver is on?

On MS-Windows there is a system window message that you can process to indicate that you don't want the screensaver to become active. You can use it to monitor when the screensaver gets active. You must be in a GUI program, from a commandline python program it does not work.

But why not sleep() a while during the loop, this will prevent from using 100%CPU

On MS-Windows there is a system window message that you can process to indicate that you don't want the screensaver to become active. You can use it to monitor when the screensaver gets active. You must be in a GUI program, from a commandline python program it does not work.

But why not sleep() a while during the loop, this will prevent from using 100%CPU

ok so i found this code

SystemParametersInfo(SPI_GETSCREENSAVEACTIVE,0,tru e,0);

how do i use it what win32 module do i need to use