'pywinauto send key down to application
I want to send key down events to game applications using pywinauto. I get the application like this:
from pywinauto.application import Application
app = Application()
app.connect(title='Adobe Flash Player 29')
win = app.window_(title_re = "Adobe Flash Player 29")
This allows me to send things like mouse clicks to the application:
win.Click(coords=(300,330))
This works fine, and I can also send "TypeKeys" events to the application:
while True:
win.TypeKeys("w")
However, instead of holding the key down, it repeatedly sends single letters to the game. I need a way to hold the key down instead (and this must be in context of an application, not just a raw keyboard input).
EDIT: I mean I want to send held key presses to applications other than the active window
Solution 1:[1]
from pywinauto.keyboard import SendKeys
<...code>
SendKeys('{DOWN}') # Keyboard input
# in case of element
element.type_keys('{DOWN}')
checkout this Link, Hope this will help you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sunil Kumar |