Is there a sendKey for Mac in Python?

后端 未结 5 1501

In Mac 10.6, I want to cause an active application to become de-active, or minimized by Python

I know I could use sendKey in Windows with Python, then what about in

5条回答
  •  再見小時候
    2020-12-02 21:54

    Here is what I found from a different question on Stack Overflow. It works pretty good for my problem.

    import os
    cmd = """
    osascript -e 'tell application "System Events" to keystroke "m" using {command down}' 
    """
    # minimize active window
    os.system(cmd)
    

提交回复
热议问题