Moving mouse, Python3 and PyObjc

Terry Reedy tjreedy at udel.edu
Thu Feb 7 19:51:14 EST 2013


On 2/7/2013 6:22 PM, joaofguiomar at gmail.com wrote:
>
> 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.

If the import fails, then the call to clickMouse should fail with 
NameError, but you said that clickMouse executes, so it is hard to 
determine what you have done and what does and does not work.

You need to post more information.

-- 
Terry Jan Reedy




More information about the Python-list mailing list