[Python] pywinauto send key down to application

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    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

    Continue reading...

Compartilhe esta Página