标签:microsoft ros == with 按键 oar python def mil
#当按键q的时候,自动输入 “大家好!”并回车键发送!
from pynput import keyboard
from pynput.keyboard import Key, Controller
kb = Controller()
def on_release(key):
try:
if key.char == "q":
kb.type(u‘大家好!!!‘)
kb.press(Key.enter)
kb.release(Key.enter)
except:
pass
while True:
with keyboard.Listener(on_release = on_release) as listener:
listener.join()
标签:microsoft ros == with 按键 oar python def mil
原文地址:https://www.cnblogs.com/zhouxinfei/p/8976782.html