python实现快捷键的方法
import pyautogui import time import keyboard import pyautogui as pag iscanzhixing=1; def test_a(): global iscanzhixing # 只能执行一次 if iscanzhixing==0: return 1; iscanzhixing=0; px,py = pag.position() #返回鼠标的坐标 time_stamp = time.time() img = pyautogui.screenshot(region=[px,py,600,600]) # x,y,w,h img.save("xx/jietu"+str( round(time_stamp * 1000) )+".jpg") iscanzhixing=1; print(iscanzhixing); keyboard.add_hotkey('z', test_a) keyboard.wait()