Skip to content

Instantly share code, notes, and snippets.

@wise-bit
Created April 25, 2023 07:15
Show Gist options
  • Select an option

  • Save wise-bit/7ae4dc89d870690f16ddb6e7daf23200 to your computer and use it in GitHub Desktop.

Select an option

Save wise-bit/7ae4dc89d870690f16ddb6e7daf23200 to your computer and use it in GitHub Desktop.
beeper
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