Skip to content
waspinator edited this page Feb 7, 2011 · 3 revisions

Since this is a very simple module, here is the very simple documentation.

Introduction

To use this plugin put the python files somewhere on the python path.

On Ubuntu, run the following commands to install the plugin from the master branch:

sudo apt-get install python-setuptools python-xlib
sudo easy_install https://github.com/pepijndevos/PyMouse/zipball/master

The next example illustrates basic usage:

# import the module
from pymouse import PyMouse

# instantiate an mouse object
m = PyMouse()

# move the mouse to int x and int y (these are absolute positions)
m.move(200, 200)

# click works about the same, except for int button possible values are 1: left, 2: right, 3: middle
m.click(500, 300, 1)

# get the screen size
m.screen_size()
# (1024, 768)

# get the mouse position
m.position()
# (500, 300)

Details

Requirements:

  • objc(Mac only)
  • ctypes(Windows only)
  • pyHooks(Windows only)
  • xlib(Unix only)
Clone this wiki locally