LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-15-2009, 05:05 AM   #1
deathalele
Member
 
Registered: May 2008
Location: deep dark north wales
Distribution: Zenwalk
Posts: 162

Rep: Reputation: 30
How can i move the mouse pointer using python


How could i create a script that will move the mouse pointer around the screen.
i'm thinking i need the Xlib modules (which i have installed) but don't know how to implement them

Thanks in advance
Iwan
 
Old 02-16-2009, 05:26 PM   #2
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
I know no python, but with Xlib in C I'd use XSendEvent().
 
Old 02-17-2009, 12:16 PM   #3
deathalele
Member
 
Registered: May 2008
Location: deep dark north wales
Distribution: Zenwalk
Posts: 162

Original Poster
Rep: Reputation: 30
could you give me a example on how to use it. because i'm learning C now and will probrably translate my program in the near future.

thanks
 
Old 02-17-2009, 12:34 PM   #4
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
could you give me a example on how to use it
I was afraid this would happen. :)

You need more than the example of a simple call to XSendEvent(). If I gave you a simple call, it wouldn't be enough. If I posted a complete application using that call to move the mouse, it would be way too much information, in a way that wouldn't be usable.

Follow these steps.
  1. scroogle this:
    Code:
    Xlib tutorial
  2. Pick a tutorial and work through it. (I'd recommend one for you, but I haven't used any of them. I cut my teeth on the O'Reilly books.)
  3. Do this at the command line:
    Code:
    man XSendEvent
  4. Come back here if your program doesn't work.
If you're learning Xlib from the ground up, the yellow brick road you're starting on is a long but interesting yellow brick road.

Good luck!
 
Old 02-17-2009, 12:59 PM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Edit: forget I said anything. My mistake.

Last edited by David the H.; 02-17-2009 at 01:00 PM.
 
Old 02-17-2009, 06:32 PM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
the xlib is indeed interesting.
Xreplay is doing this.
Segfaults included..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Move mouse pointer to the next default button kdrlx Linux - Software 0 12-17-2007 07:50 PM
How should I move my Mouse pointer yugandhar Programming 1 07-25-2006 07:56 AM
XFree86 - can't move mouse pointer Lenard Spencer Linux From Scratch 3 07-23-2006 04:47 PM
move mouse pointer from shell script malo_umoran Slackware 1 11-06-2004 08:31 AM
how to move pointer w/o using mouse in X gongli Linux - Software 1 10-22-2003 07:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration