Moving mouse, Python3 and PyObjc

joaofguiomar at gmail.com joaofguiomar at gmail.com
Thu Feb 7 18:22:01 EST 2013


import objc

def clickMouse(x, y, button):
    bndl = objc.loadBundle('CoreGraphics', globals(), '/System/Library/Frameworks/ApplicationServices.framework')
    objc.loadBundleFunctions(bndl, globals(), [('CGPostMouseEvent', 'v{CGPoint=ff}III')])
    CGPostMouseEvent((x, y), 1, button, 1)
    CGPostMouseEvent((x, y), 1, button, 0)
 
clickMouse(600,500, 1)  


this seems to send the mouse cursos to the top left corner, no matter what coords i send on clickMouse...


Also, I just can't seem to install PyObjc and use it on Python3.3 ... always get No module named objc.

Sighs... Made a simple python app while at work (windows 7) and was trying to change it to work on Os X (home computer) but cant even get the basics done (move and click mouse)....


Thank you.



More information about the Python-list mailing list