minor improv.

This commit is contained in:
2025-03-23 00:06:07 +08:00
parent 84372e6dd8
commit da3da80b17
5 changed files with 33 additions and 214 deletions

View File

@@ -1,3 +1,8 @@
# 实验与参考用代码
仅作技术分析验证与历史留存, 若要修改此项目代码, 不必处理此文件夹
若你要使用此软件, 可以克隆后直接将 testfield 文件夹删除
若你要使用此软件, 可以克隆后直接将 testfield 文件夹删除
子目录说明:
- legacy: 旧版飞控系统存档
- vgl: 矢量图形绘制库
- network: sin 波形传输
- visual: "总览"组件开发

27
testfield/kbemu/1.py Normal file
View File

@@ -0,0 +1,27 @@
import time
from pynput.keyboard import Controller
import threading
# 创建键盘控制器
keyboard = Controller()
def press_keys():
while True: # 持续循环
keyboard.press('1') # 按下 'w' 键
time.sleep(0.5) # 等待0.5秒
keyboard.release('w') # 释放 'w' 键
keyboard.press('d') # 按下 'd' 键
time.sleep(0.5) # 等待0.5秒
keyboard.release('d') # 释放 'd' 键
# 创建并启动线程
thread = threading.Thread(target=press_keys)
thread.daemon = True # 设置为守护线程
thread.start()
# 主线程可以在这里执行其他操作
try:
while True:
time.sleep(1) # 主线程保持运行
except KeyboardInterrupt:
print("程序已停止。")

BIN
testfield/visual/1view.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 992 KiB