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.
22 lines
487 B
Python
22 lines
487 B
Python
import threading
|
|
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}")
|
|
except AttributeError:
|
|
pass
|
|
with keyboard.Listener(on_press=on_press) as listener:
|
|
listener.join()
|
|
threading.Thread(target=listener_keyword).start()
|
|
|