From 861ad5294e82479c0f9ac740a61f9fbe5868146d Mon Sep 17 00:00:00 2001 From: Dawn_Ocean <1785590531@qq.com> Date: Thu, 19 Oct 2023 21:08:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=AE=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keymap.txt | 19 +++++++++++++------ main.py | 4 ++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/keymap.txt b/keymap.txt index 78d09c7..ba08d39 100644 --- a/keymap.txt +++ b/keymap.txt @@ -3,11 +3,18 @@ # 文件以 '$' 号单独占一行结束,请勿删除 # 映射配置格式:[按钮编号]:[键位] -0 : Q -1 : W -2 : E -3 : R -4 : T -5 : Y +A0 : Q +A1 : W +A2 : E +A3 : R +A4 : T +A5 : Y + +D2 : U +D3 : I +D4 : O +D5 : P +D6 : [ +D7 : ] $ \ No newline at end of file diff --git a/main.py b/main.py index a64dafd..d630f54 100644 --- a/main.py +++ b/main.py @@ -31,7 +31,7 @@ def detect(): def com_simulate(message): print(message) - key = maps[int(message[1])] # 判断按下了哪个按钮 + key = maps[message[0:2]] # 判断按下了哪个按钮 if 'U' in message: keyUp(key) elif 'D' in message: @@ -52,7 +52,7 @@ if __name__ == "__main__": while line != "$": if line: keymap = line.split(':') - maps[int(keymap[0].strip())] = keymap[1].strip() + maps[keymap[0].strip()] = keymap[1].strip() line = f.readline().strip().split('#')[0] print("构建完毕!")