You can use the keyboard library to check whether the caps lock key is pressed or not, and use pyautogui library to pause the loop. Here's the code:
main.py221 chars11 lines
In this code, we are using an infinite while loop and checking if the caps lock key is pressed. If it is, we set the pyautogui.PAUSE
variable to 1 (which means a 1-second delay between each pyautogui function call), and print 'Caps Lock is down'. If the caps lock key is not pressed, we set the pyautogui.PAUSE
variable to 0 (which means no delay), and print 'Caps Lock is up'.
gistlibby LogSnag