You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
656 B
Python
28 lines
656 B
Python
import threading
|
|
|
|
import winsound
|
|
from pynput import keyboard
|
|
|
|
IS_START = False
|
|
|
|
def get_start():
|
|
return IS_START
|
|
|
|
def listener_keyword():
|
|
def on_press(key):
|
|
global IS_START
|
|
try:
|
|
if key.char == "=":
|
|
IS_START = not IS_START
|
|
print(f"IS_START: {IS_START}")
|
|
if IS_START:
|
|
winsound.Beep(800, 200)
|
|
else:
|
|
winsound.Beep(400, 200)
|
|
except AttributeError:
|
|
pass
|
|
with keyboard.Listener(on_press=on_press) as listener:
|
|
listener.join()
|
|
threading.Thread(target=listener_keyword, daemon=True).start()
|
|
|