- UID
- 138051
- 帖子
- 445
- 主題
- 19
- 精華
- 0
- 積分
- 1154
- 楓幣
- 21323
- 威望
- 1131
- 存款
- 10
- 贊助金額
- 0
- 推廣
- 0
- GP
- 44
- 閱讀權限
- 70
- 性別
- 男
- 在線時間
- 451 小時
- 註冊時間
- 2016-4-30
- 最後登入
- 2024-12-22
|
- 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()
複製代碼 |
|