2

I want to find a way in Python for detecting "Keyboard event" like PyUserInput. I dont want the keyboard to type any character after pressing a button, and ONLY call me event occured.

For example, after pressing the "s" key run the event handler but not typing "S"! this action should be applied in all over the windows not frames such as "Tkinter"

(I want to grab keyboard output signal by python)

2
  • Are you using a window manager or not? If not, lookup curses Commented Jul 22, 2015 at 7:29
  • I use pyuserinput, and think it use window manager Commented Jul 22, 2015 at 7:37

1 Answer 1

1

What you're trying to do isn't feasible with python. What you want to do is essentially make a new driver for your mouse/keyboard.

This is not system independent and there's no good/nice way of doing this with python.

PyUserInput attempts to abstract out the system dependency - but this is not complete, and it cannot override the keyboard/mouse completely. What it can do is it can mimic actions on your mouse or keyboard only if the application allows emulated actions. A lot of programs like games and a bunch of other software disable emulated actions.

The most stable and significant tool which is not a driver level tool are autoit and autohotkey - you could try making an autoit/autohotkey script which is executed as a python subprocess and use pipes to send and get info from the script.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.