2

How can I use an analog joystick in Python on Linux? I come from a C++ background, where I used joystick.h to read events from /dev/input/js[x]. Is there a python wrapper around this I can use, perhaps? I don't really want to have to use a huge library like pyGame or SDL?

asked Aug 18, 2013 at 15:42
1
  • I don't know if it's the same interface, but this might be what you're looking for. sourceforge.net/projects/joy2xev Commented Aug 19, 2013 at 21:20

3 Answers 3

3

This gist worked for me on Ubuntu 15.04 without modification.

answered Jun 16, 2015 at 22:12
Sign up to request clarification or add additional context in comments.

Comments

2

There is evdev, It's only for Linux, and it seems to be able to do much more than just handling joystick. I've never tried it, though.

I spent some time looking for a library to only read joystick in a cross-platform way, but didn't find any, and I've ended up with pygame (only initializing joystick and event modules) in my projects.

answered Jan 13, 2014 at 9:48

Comments

0

Now (2016+) there's a new sufficiently multiplatform Python module called "inputs" that you can find on GitHub or install from Pipy

It can read joysticks, controllers, keyboards and mices and seems to offer a good support for all their features, including vibration where available.

answered Feb 16, 2018 at 7:21

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.