小编Moa*_*cir的帖子

Pywinauto 计时等待 0.5 秒而不是立即

我有以下 Pywinauto 代码,等待时间为 0.5 秒而不是立即。怎么立即拿到?

  • 要单击按钮并转到下一条消息:
from pywinauto import application, timings, mouse
import time

app = application.Application()
app.connect(title = 'Mensagem')
app = app.Mensagem
app2 = app.TBPanel2
buttonCoord = int((app2.rectangle().right - app2.rectangle().left)/2/2), int((app2.rectangle().bottom - app2.rectangle().top)/2)
buttonCoord = buttonCoord[0]*(2*2-1),buttonCoord[1]
timings.Timings.after_clickinput_wait = 0.001
timings.Timings.after_setcursorpos_wait = 0.001

starttime = time.perf_counter()
#while app.Edit1.texts()[0] != '':
for i in range(10):
    buttonCoord = int((app2.rectangle().right - app2.rectangle().left)/2/2), int((app2.rectangle().bottom - app2.rectangle().top)/2)
    buttonCoord = buttonCoord[0]*(2*2-1),buttonCoord[1]
    app2.click_input(button='left', coords=(buttonCoord))
    print('Entre cliques demorou ', str(time.perf_counter()-starttime), ' segundos')
    starttime = time.perf_counter()
Run Code Online (Sandbox Code Playgroud)

当我运行时,点击之间的间隔是 0.5 秒: …

python automation pywinauto python-3.x

6
推荐指数
1
解决办法
575
查看次数

标签 统计

automation ×1

python ×1

python-3.x ×1

pywinauto ×1