Код: Выделить всё
def start():
while True:
if keyboard.is_pressed('alt+s'):
break
...
def main():
while True:
if keyboard.is_pressed('alt+p'):
start()
Код: Выделить всё
def main():
keyboard.add_hotkey('alt+p', start, args=(), suppress=True, trigger_on_release=True)
while True:
# waiting for the user to press hotkey
continue
Есть ли лучшее решение?
Подробнее здесь: https://stackoverflow.com/questions/722 ... -in-python
Мобильная версия