- UID
- 138051
- 帖子
- 441
- 主題
- 19
- 精華
- 0
- 積分
- 1152
- 楓幣
- 21245
- 威望
- 1130
- 存款
- 10
- 贊助金額
- 0
- 推廣
- 0
- GP
- 44
- 閱讀權限
- 70
- 性別
- 男
- 在線時間
- 446 小時
- 註冊時間
- 2016-4-30
- 最後登入
- 2024-11-8
|
- import keyboard
- import asyncio
- import threading
- import random
- KeyEvenStat = 0
- def keyStart():
- global KeyEvenStat
- while True:
- if KeyEvenStat == 0:
- pass
- else:
- randomkey = random.randint(0,9)
- print(randomkey)
- if randomkey == 0:
- keyboard.write("=")
- else:
- keyboard.write(str(randomkey))
- asyncio.run(asyncio.sleep(0.5))#調整速度
- def abc(x):
- global KeyEvenStat
- print(str(x))
- if str(x) == 'KeyboardEvent(f3 down)':#按下F3開始
- KeyEvenStat = 1
- if str(x) == 'KeyboardEvent(f4 down)':#按下F4結束
- KeyEvenStat = 0
- t=threading.Thread(target=keyStart)
- t.start()
- keyboard.hook(abc)
- keyboard.wait()
複製代碼 |
|