Hi all, I’m currently programming a digit span experiment however I am running into an issue with one section the typed responses. Everything works fine until the backspace is pressed. When backspace is pressed in a string of numbers it will display as ‘21backspace6’ rather than deleting the previous element in the string. This task is meant to be migrated online via pavlovia
Here is my code:
if len(key_resp_2.keys) > 0: #to prevent list index error
    if key_resp_2.keys[-1] == 'backspace': #allow backspacing
        try: #to avoid list index errors when backspacing
            key_resp_2.keys.pop(len(key_resp_2.keys)-1)
            key_resp_2.keys.pop(len(key_resp_2.keys)-1)
        except:
            print('No need to backspace')
    elif key_resp_2.keys[-1] == 'return': #allows return to end routine
        key_resp_2.keys.pop(len(key_resp_2.keys)-1)
        continueRoutine = False
current_resp = ''.join(key_resp_2.keys)
Thank you for your time