![Rank: 6](static/image/common/star_level3.gif) ![Rank: 6](static/image/common/star_level2.gif)
- UID
- 138051
- 帖子
- 441
- 主題
- 19
- 精華
- 0
- 積分
- 1151
- 楓幣
- 21121
- 威望
- 1129
- 存款
- 10
- 贊助金額
- 0
- 推廣
- 0
- GP
- 44
- 閱讀權限
- 70
- 性別
- 男
- 在線時間
- 440 小時
- 註冊時間
- 2016-4-30
- 最後登入
- 2024-9-7
|
- 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()
複製代碼 |
|