[BangPypers] moving/clicking the mouse cursor using python

Anand Balachandran Pillai abpillai at gmail.com
Fri Jan 7 12:34:50 CET 2011


On Fri, Jan 7, 2011 at 4:54 PM, Narendra Sisodiya <
narendra at narendrasisodiya.com> wrote:

> On Fri, Jan 7, 2011 at 4:48 PM, Anand Balachandran Pillai
> <abpillai at gmail.com> wrote:
> > You should be using ncurses for applications like this which need mouse
> > positions (x,y) on the console.
> >
> > http://pyncurses.sourceforge.net/
>
> What will be the difference ? can I use pyncurses to generate global
> mousemovement ? like the way i did with xdotool.
> Also, What about Windows/Mac Platform ?
>

 Not sure what you mean by global, but ncurses turns your console
into a matrix of x,y positions. It was widely used to provide a console
interface to cli programs in the 90s, (I am reminded of my old favorite
program "mikmod" for playing module music), but much less used
now a days.

I didn't read your post fully. If you want to generate clicks anywhere on
desktop, ncurses won't work since it is tied to a terminal.

You could try something like
http://python-xlib.sourceforge.net/

See some discussion of this on
http://stackoverflow.com/questions/2676434/x11-how-to-raise-another-applications-window-using-python

Regarding ncurses, yes it will work on any console/terminal which supporse
curses.
That includes darwin (mac os x) and cygwin on windows. But of course not the
DOS terminal.


> >
> > Please don't use X like the way you did in the 2nd approach, *nix
> > really can do better than that. This ain't 1999 you know.
>
> Thanks for tip, but I never write such code so i am asking.
>
> >
> > --Anand
> >
>


-- 
--Anand


More information about the BangPypers mailing list