Created
April 25, 2023 07:15
-
-
Save wise-bit/7ae4dc89d870690f16ddb6e7daf23200 to your computer and use it in GitHub Desktop.
beeper
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
| import winsound | |
| import keyboard | |
| import time | |
| try: | |
| tick = time.time() - 59 | |
| count = 0 | |
| while True: | |
| if time.time() - tick >= 60: | |
| frequency = 800 # Hertz | |
| duration = 500 # ms | |
| winsound.Beep(frequency, duration) | |
| tick = time.time() | |
| count += 1 | |
| if keyboard.is_pressed("`"): | |
| # print(f"total ticks: {count}") | |
| break | |
| finally: | |
| print(f"total ticks: {count}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment