Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Create Linux input device drivers with Python.

Fix mouse example in README

Pointer does not move if the device is created without button
descriptors, because buttonless pointer device is not recognized as a
mouse by Xorg.
latest commit ac5606b14d
Tuomas Räsänen authored
Octocat-spinner-32 examples Add short magical sleep to keyboard example June 06, 2013
Octocat-spinner-32 libsuinput Update libsuinput July 18, 2013
Octocat-spinner-32 src Revert "Fix Python3-compatibility issue: add soabi part to .so filepath" August 19, 2013
Octocat-spinner-32 udev-rules Added udev rule to chgrp uinput to group 'uinput' June 01, 2012
Octocat-spinner-32 COPYING Updated project details, such as homepage, download url, etc. October 17, 2010
Octocat-spinner-32 Include libudev.h in source distributions July 18, 2013
Octocat-spinner-32 NEWS Release 0.10.1 August 19, 2013
Octocat-spinner-32 README Fix mouse example in README February 16, 2014
Octocat-spinner-32 Release 0.10.1 August 19, 2013

Python-uinput is Python interface to Linux uinput kernel module which
allows attaching userspace device drivers into kernel. In practice,
Python-uinput makes it dead simple to create virtual joysticks,
keyboards and mice for generating arbitrary input events

Author: Tuomas Räsänen <>
Homepage: <>

Usage examples

Generate keyboard clicks:

  import uinput
  device = uinput.Device([uinput.KEY_E, uinput.KEY_H, uinput.KEY_L, uinput.KEY_O])

Move mouse cursor:

  import uinput
  device = uinput.Device([uinput.REL_X, uinput.REL_Y,
                          uinput.BTN_LEFT, uinput.BTN_RIGHT])
  for i in range(20):
      device.emit(uinput.REL_X, 5)
      device.emit(uinput.REL_Y, 5)

Generate keyboard combinations:

  import uinput
  device = uinput.Device([uinput.KEY_LEFTALT, uinput.KEY_TAB])
  device.emit_combo([uinput.KEY_LEFTALT, uinput.KEY_TAB])

See examples/ for other kind of example devices (keyboard, joystick).

How to install

Just run the following commands:

  python build
  python install

How to report bugs

The bug database is hosted in Launchpad. If you have found a bug or
have an improvement idea you want to share, please report it at
<>. However, to avoid
duplicate bug reports, before reporting, please check if similiar or
identical bug has already been reported. If so, you can still
subscribe to the existing bug to track its progress.

If you are unsure whether the problem you have is due to a bug, you
can always ask questions at

How to contribute

In addition to reporting bugs and improvement suggestions, you are
encouraged to contribute bug-fixes or features. The source code is
maintained in Git and the main repository is hosted at GitHub,
<>. The preferred way
to contibute code is to clone the main Git repository and send a
pull-request. Good old patches via email are also accepted.

How to copy

Python-uinput is free (libre) software and licensed under the terms of
GNU Public License version 3 or later. In short, it means that you are
free to copy, modify and redistribute this software as long as you
place the derivative work under a compatible license. See COPYING for
Something went wrong with that request. Please try again.