Created
July 21, 2016 06:28
-
-
Save vgrivtsov/fb9245c31c80c2865746f57c3eb0f340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__"Victor Grivtsov" | |
| # -*- coding: utf-8 -*- | |
| # Work pause generator, beep on 45 min of hour and blocking keyboard and mouse | |
| # and unblocking after 15 minutes | |
| import sys | |
| import time | |
| from ctypes import * # windll.user32 , win32con need use for mouse_events | |
| import win32api | |
| def timer(): | |
| while True: | |
| minutes = (time.strftime('%M')) | |
| while minutes != '45': | |
| sys.stdout.write(time.strftime('\r%M:%S')) | |
| time.sleep(1) | |
| minutes = time.strftime('%M') | |
| print("\nBlock computer!") | |
| win32api.Beep(2000, 2000) | |
| windll.user32.BlockInput(True) # block mouse&keyboard | |
| time.sleep(900) | |
| windll.user32.BlockInput(False) # unblock mouse&keyboard | |
| print("\nUnBlock computer!") | |
| win32api.Beep(1000, 2000) | |
| if __name__ == '__main__': | |
| timer() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment