views:

142

answers:

2

In Moc10.6, I want to put a active application to de-active, or minimize by Python

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

Thanks, guys!

+1  A: 

Here is what I found from a different question in stackoverflow. It works pretty good to my problem.

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

Maybe you could run an OSA script (man osascript) from Python, for instance, and drive the application?

EOL