我试图用pynput模块在Python中“重新映射”击键。 我的目标是设置一些字符串,抑制来自物理键盘的输入,然后当我在键盘上键入任何内容时,它总是通过击键来写入字符串
实际上,我是通过自动键入字符串来完成的,它工作得很好,但我只需要一次一次地键入
提前感谢:)
这就是我所做的
from pynput import keyboard
import time
c = keyboard.Controller()
a = 1
number = 0
text = str(input("Enter text number "))
def opisovani(string, number):
def split(word):
return [char for char in word]
while wordcount != number:
list = (split(string))
word = (list[number])
c.press(word)
time.sleep(0.1)
c.release(word)
print(number)
number = number + 1
while a == 1:
if text == "1":
print("im here")
string = "computer"
time.sleep(1)
wordcount = len(string)
a = 12
opisovani(string, number)
目前没有回答
相关问题 更多 >
编程相关推荐