Numbers on the right side of the keyboard are not working

The keys on the numerical keys registers as “num_1”, “num_2”, etc. whereas the number-keys above the letters register as “1”, “2”, etc. So to treat both equal, do something like this:

from psychopy import event
allowed_keys = ['1', '2', '3', 'num_1', 'num_2', 'num_3']
key = event.waitKeys(keyList=allowed_keys)[0]  # wait for keys and pick the first one
number = key[-1]  # take the last character in the string. '2' and 'num_2' will both become just '2'.

You could also do something more general if you just want to react to all number keys:

key = event.waitKeys()[0]  # allow all keys, pick first
try: 
    number = int(key[-1])  # convert last character to integer. ValueError if not
    print number
except ValueError:
    print 'you did not press a number!'