Display of a stimulus as long as a key is pressed not working online

I would use.

if key_resp.keys:
     is 'space' in key_resp.keys:
          appearance = 1