Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38438

Re: Moving mouse, Python3 and PyObjc

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joaofguiomar@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'skip:[ 20': 0.03; 'argument': 0.04; 'importing': 0.04; 'deprecated': 0.07; 'mouse': 0.07; 'python': 0.09; 'skip:[ 30': 0.09; 'skipping': 0.09; 'subject:Python3': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; '2.7': 0.13; '(windows': 0.16; '(windows)': 0.16; '3.3.': 0.16; 'alot': 0.16; 'declaration': 0.16; 'doesnt': 0.16; 'fail,': 0.16; 'globals(),': 0.16; 'install.': 0.16; 'libs': 0.16; 'url:packages': 0.16; 'win32api': 0.16; 'write,': 0.16; 'examples': 0.18; 'app': 0.19; 'module': 0.19; 'trying': 0.21; 'import': 0.21; 'meant': 0.21; 'button,': 0.22; 'implicit': 0.22; 'cc:2**0': 0.23; 'errors': 0.23; 'installed': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'installing': 0.27; 'module.': 0.27; 'replace': 0.27; 'went': 0.28; "skip:' 50": 0.29; 'install': 0.29; "skip:' 10": 0.30; 'skip:( 40': 0.30; 'function': 0.30; 'code': 0.31; 'url:python': 0.32; 'mac': 0.32; "skip:' 20": 0.32; 'could': 0.32; 'goes': 0.33; 'version': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'done': 0.34; 'similar': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'modules': 0.36; "didn't": 0.36; 'thank': 0.36; 'moment': 0.37; 'ones': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'gives': 0.39; 'you.': 0.61; 'matter': 0.61; 'subject:, ': 0.61; 'results': 0.65; 'home': 0.66; 'saw': 0.75; 'upper': 0.75; 'click': 0.76; 'received:209.85.216.184': 0.84; 'running,': 0.84; 'subject:Moving': 0.84; 'url:api': 0.84; 'cursos': 0.91
X-Received by 10.49.47.109 with SMTP id c13mr397690qen.3.1360319535339; Fri, 08 Feb 2013 02:32:15 -0800 (PST)
Newsgroups comp.lang.python
Date Fri, 8 Feb 2013 02:32:15 -0800 (PST)
In-Reply-To <mailman.1468.1360289355.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=217.129.135.80; posting-account=WVCJQgoAAAAmDtBD-6D5tdC9-bKgbcuJ
References <da8d9786-1e39-44c0-80af-14dab2327074@googlegroups.com> <mailman.1468.1360289355.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 217.129.135.80
MIME-Version 1.0
Subject Re: Moving mouse, Python3 and PyObjc
From Oneill <joaofguiomar@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.1496.1360320059.2939.python-list@python.org> (permalink)
Lines 107
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360320059 news.xs4all.nl 6851 [2001:888:2000:d::a6]:56403
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38438

Show key headers only | View raw


> 
> >
> 
> > 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.
> 
> >
> 
> 
> 
> What's the objc module got to do with the mouse?
> 
> 
> 
>      http://packages.python.org/pyobjc/api/module-objc.html
> 
> 
> 
> Perhaps you meant some other module.  Could you be specific?  What 
> 
> modules did you import, what other code did you write, what version of 
> 
> Python are you running, and on which computer OS did you get the results 
> 
> you describe?
> 
> 
> 
> -- 
> 
> DaveA



Well without PyObjc i couldnt control the mouse... I saw some examples importing Quartz  but that also failed...

I have python 2.7 installed and 3.3. I started building the app using Python 3.3 at work (windows) and importing win32api and win32con. Everything went smoothly.

At home I was going to import OS X libs to replace the win32 ones to control the mouse in OS X. I tried installing autopy and it fails

"clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
src/screengrab.c:48:26: warning: implicit declaration of function 'CGDisplayBitsPerPixel' is invalid in C99 [-Wimplicit-function-declaration]
        bitsPerPixel = (uint8_t)CGDisplayBitsPerPixel(displayID);
                                ^
src/screengrab.c:191:2: warning: 'CGLSetFullScreen' is deprecated [-Wdeprecated-declarations]
        CGLSetFullScreen(glContext);
"


PyObjc used to ouput similar errors but i tried with the env CC=clang and at least it doesnt fail, but gives me alot of skipping and warnings.


also tried PyMouse but that didn't work also, couldnt install.



At the moment I can click the mouse and it actually moves, but no matter what coords I place it always goes to the upper left corner.


Mac Os X 10.8.2
Python 2.7 / 3.3
Im using Komodo Edit

also installed ActivstatePython.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Moving mouse, Python3 and PyObjc joaofguiomar@gmail.com - 2013-02-07 15:22 -0800
  Re: Moving mouse, Python3 and PyObjc Terry Reedy <tjreedy@udel.edu> - 2013-02-07 19:51 -0500
  Re: Moving mouse, Python3 and PyObjc Dave Angel <davea@davea.name> - 2013-02-07 21:08 -0500
    Re: Moving mouse, Python3 and PyObjc Oneill <joaofguiomar@gmail.com> - 2013-02-08 02:32 -0800
      Re: Moving mouse, Python3 and PyObjc Dave Angel <davea@davea.name> - 2013-02-08 09:36 -0500
    Re: Moving mouse, Python3 and PyObjc Oneill <joaofguiomar@gmail.com> - 2013-02-08 02:32 -0800
  Re: Moving mouse, Python3 and PyObjc Oneill <joaofguiomar@gmail.com> - 2013-02-08 02:24 -0800

csiph-web