import subprocess from configparser import ConfigParser, NoOptionError, NoSectionError from datetime import datetime from os import getcwd, path, mkdir from pynput.keyboard import Listener config_path = path.join(getcwd(), 'config') config_file = path.join(config_path, 'config.ini') readme_file = 'readme.txt' def warp_before_exec(func): def inner(*args, **kwargs): print('----========############################========----') print(f'\n{datetime.now().strftime("%Y-%m-%d %H:%M:%S")} 正在執(zhí)行 \n') result = func(*args, **kwargs) print(f'\n{datetime.now().strftime("%Y-%m-%d %H:%M:%S")} 執(zhí)行完畢 \n') return result return inner class KeyboardListener: """通過讀取鍵盤上的按鍵去匹配配置文件中的快捷鍵,從而執(zhí)行快捷鍵下的指令 """ def __init__(self): self.key_list = [] self.hot
文章來源地址http://www.zghlxwxcb.cn/news/detail-500936.html
文章來源:http://www.zghlxwxcb.cn/news/detail-500936.html
到了這里,關(guān)于python pynput監(jiān)聽鍵盤的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!