pywinauto 的滚动问题
Scrolling issues with pywinauto
我正在尝试在 excel 文档中滚动(使用 pywinauto),但它似乎不起作用。
代码:
app = Application(backend="uia").connect(process=8876)
win = app.top_window()
win.set_focus()
win.wheel_mouse_input(wheel_dist=10)
set_focus 有效,但滚动不起作用,我也尝试使用 wheel_dist没有成功。
另一个问题,有没有办法滚动Right/Left?
谢谢。
我直接使用pywinauto.mouse解决了这个问题,而不是通过[=31=使用wheel_mouse_input ] 目的。我还需要找到正确的坐标。所以这是新代码:
app = Application(backend="uia").connect(process=8876)
win = app.top_window()
win.set_focus()
win_rect = win.rectangle()
coords = (random.randint(win_rect.left, win_rect.right), random.randint(win_rect.top, win_rect.bottom))
pywinauto.mouse.scroll(coords=coords, wheel_dist=10)
我通过使用 pyautogui 库解决了 "right/left scrolling" 这个问题,它有一个函数,叫做 hscroll:
pyautogui.hscroll(10)
我没有在 pywinauto
中找到类似的东西
.wheel_mouse_input(wheel_dist=100) 似乎对我有用。我只在 Word 中检查过这个,但希望它也能在 Excel.
中使用
我正在尝试在 excel 文档中滚动(使用 pywinauto),但它似乎不起作用。
代码:
app = Application(backend="uia").connect(process=8876)
win = app.top_window()
win.set_focus()
win.wheel_mouse_input(wheel_dist=10)
set_focus 有效,但滚动不起作用,我也尝试使用 wheel_dist没有成功。
另一个问题,有没有办法滚动Right/Left?
谢谢。
我直接使用pywinauto.mouse解决了这个问题,而不是通过[=31=使用wheel_mouse_input ] 目的。我还需要找到正确的坐标。所以这是新代码:
app = Application(backend="uia").connect(process=8876)
win = app.top_window()
win.set_focus()
win_rect = win.rectangle()
coords = (random.randint(win_rect.left, win_rect.right), random.randint(win_rect.top, win_rect.bottom))
pywinauto.mouse.scroll(coords=coords, wheel_dist=10)
我通过使用 pyautogui 库解决了 "right/left scrolling" 这个问题,它有一个函数,叫做 hscroll:
pyautogui.hscroll(10)
我没有在 pywinauto
中找到类似的东西.wheel_mouse_input(wheel_dist=100) 似乎对我有用。我只在 Word 中检查过这个,但希望它也能在 Excel.
中使用