#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Version : 3.8
# @Author : QQ736592720
# @Datetime : 2023/1/12 15:33
# @Project : smf
# @File : my_key.py
import keyboard
import pyautogui as dm
dm.PAUSE = 0.01
def KeyPress(key):
'''
键盘按键
:param key:要输入的东西(注意不能是汉字) str or int
:return:会显示出来 None
'''
dm.press(key) # 按键
def Hotkey(key1,key2):
'''
组合按键
:param1 key1:'Ctrl'
:param2 key2:'V'
:return:会显示出来 None
'''
dm.hotkey(key1,key2) # 按键
def KeyDown(key):
'''
键按下
:key要按下的字母或数字(只能有一个)
:return: None
'''
dm.keyDown(key)
def KeyUp():
'''
键弹起
:return:
'''
dm.keyUp()
def KeyPressList(keylist):
'''
:param keylist:
:return:
'''
for key in keylist: dm.press(key)
def WaitKey(k):
'''
:param k:
:return:
'''
keyboard.wait(k)
if __name__ == '__main__':
k = WaitKey("q")
print("继续运行....")
print(k)
python实现按键精灵之按键操作key
最新推荐文章于 2023-09-10 09:56:27 发布