Reputation: 685
I am trying to perform the zoom in/out command with pywinauto
.
I have two solutions in mind. The first one is emulating the CTRL + wheel command.
I must say the window seems to zoom in, but the wheel_dist
parameter does not effect the amount of zoom.
import pywinauto
import random
app = pywinauto.application.Application(backend='uia').connect(title_re='BlueStacks')
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.keyboard.send_keys('{VK_CONTROL down}')
pywinauto.mouse.scroll(coords=coords, wheel_dist=100)
pywinauto.keyboard.send_keys('{VK_CONTROL up}')
The second solution is emulate the CTRL + + command. The solution does not work.
pywinauto.keyboard.send_keys('{VK_CONTROL down}{+ 20}{VK_CONTROL down}')
I have read the documentation and I don't find anything wrong with my code. I suppose this operation is not fully supported, but I am here to listen and learn.
Any thoughts?
Upvotes: 3
Views: 478
Reputation: 716
This code works:
pywinauto.keyboard.send_keys("{VK_CONTROL down}")
for i in range(9):
pywinauto.keyboard.send_keys("{+ down}")
time.sleep(0.01)
pywinauto.keyboard.send_keys("{+ up}")
time.sleep(0.01)
pywinauto.keyboard.send_keys("{VK_CONTROL up}")
But nothing is wrong with your code. You should add an issue in: https://github.com/pywinauto/pywinauto/issues
Upvotes: 1