Okay, so I am writing a media player and I would like to be able to control the entire thing without the use of a GUI. So...are there any libraries or anything that would allow me to collect keystrokes on any OS (not just Windows)?

Thanks in advance.

Recommended Answers

All 6 Replies

I don't think there is a lib that can cover all operating systems that use python, because they are all coded differently (I could be wrong, though :p) I know that you can grab key+mouse(and mouse wheel) input (outside of the main window) with pyhook http://sourceforge.net/apps/mediawiki/pyhook/index.php?title=Main_Page It's pretty resourcful; I was able to write a program that controlled itunes outside of the main python program using mouse input that pyhook grabbed

Okay, thanks for the idea/link. But is there any way at all I could make this compatible with Linux?

I think you might have to do some research yourself there :p i really dont know about linux

take a look into xorg's xlib. It was mentioned in one of my threads.

ov3rcl0ck is the one who mentioned it.
I don't know anything about linux so you'd have to talk to him.

Okay, well after about an hour of finding nothing, I worked out a perfect solution. So, it turns out that there is a part of the xlib that Tech B mentioned named "xbindkeys". After installing it, you can configure hotkeys in your .xbindkeysrc file and have the system run the file of your choice upon pressing a hotkey: this is exactly what I wanted.

Thanks for the ideas guys. Problem solved.

Glad I could help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.