好吧我在这里有一些代码,我试图做一个紧急退出按钮,但由于某种原因它不适合我,也许你可以帮助 . 所以这是我的代码首先关闭

from pyhooked import Hook, KeyboardEvent, MouseEvent
import pyautogui, os, sys, time

print "to stop Press CONTROl + A\n"
Ammo = raw_input('Enter ammo amount: ')

def handle_events(args):
    if isinstance(args, KeyboardEvent):

        if args.current_key == 'A' and args.event_type == 'key down' and 'Lcontrol' in args.pressed_key:
            hk.exit()
        if args.current_key == 'B' and args.event_type == 'key down' and 'Lcontrol' in args.pressed_key:

            for i in range(int(Ammo)):
                (pyautogui.click(button='right'))
                (pyautogui.moveRel(2, 2, duration=0.01))
                (pyautogui.click(button='right'))
                (pyautogui.moveRel(-2, -2, duration=1.58))



hk = Hook()
hk.handler = handle_events
hk.hook()

所以在这个代码中我拥有它所以我可以运行该程序然后去我的游戏并单击我的键盘连接到我的程序运行其动作然后它将执行此操作当我离开我的电脑节省我的时间 . 所以我需要帮助的地方是当我回到我的电脑时,我需要能够再次控制它,但我的关闭程序键绑定不起作用 .

所以启动动作的键绑定是CTLR B然后当我想退出程序时,我需要CTLR A Keybind来覆盖CTLR B动作并关闭程序 . 如果有人帮助我,那将是如此惊人的感谢先进的<3