2

I started using pyHook because I wanted a function to be called whenever the user pressed a specific key. This is my code:

def on_keyboard_event(event):
    if event.KeyID == 79:        # ID 79 = 'o' key
        next_query()             # this is a function I created
    return True

However, this means that everytime the user presses 'o', the function is called, even if the user is just writing 'hello' or 'oh!'. So I was wondering if it would be possible to tell python that I want it to run the function only when that key is pressed separately from others, just when the user presses 'o' and nothing else.

Thanks in advance!

Acla
  • 141
  • 3
  • 12

0 Answers0