# Getting written responses

**URL:** <https://discourse.psychopy.org/t/getting-written-responses/11630>\
**Category:** Coding\
**Created:** [March 21, 2020, 12:28pm UTC](https://discourse.psychopy.org/t/getting-written-responses/11630 "2020-03-21T12:28:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GIULIA\_SFRISO](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/giulia_sfriso/32/7250_2.png) [@GIULIA\_SFRISO](https://discourse.psychopy.org/u/GIULIA_SFRISO)\
**Post date:** [March 21, 2020, 12:28pm UTC](https://discourse.psychopy.org/t/getting-written-responses/11630/1 "2020-03-21T12:28:06Z")

</div>

Mac OS Catalina 10.15.3

PsychoPy3

Hello all!  
I’m trying to get typed responses on PsychoPy. I’m not good at coding and this is my first time. The issue is that when I press “backspace”, “return” or “space” on the keyboard, it seems to work but then the key name appears on the screen.  
Can anyone help me?  
Thank you!

 ![Schermata 2020-03-21 alle 13.20.41](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/5/b/5bbb887a827569f10b7a1228a6f582e1d33f4d82.png)

Coder:

Begin routine:

```
screen_text = ''

```

Each frame:

```
if("backspace"in key_Resp.keys):
    key_Resp.keys.remove("backspace")
    if(len(key_Resp.keys) > 0):
       key_Resp.keys.pop()
    
elif("space"in key_Resp.keys):
     key_Resp.keys.remove("space")
     key_Resp.keys.append(" ")

elif("return"in key_Resp.keys):
     key_Resp.keys.remove("return")

    if(len(key_Resp.keys) > 2):
       screen_text = ''.join(key_Resp.keys)
       thisExp.addData("recall_resp".screen_text)

    continueRoutine = False

    screen_text = ''.join(key_Resp.keys)
```

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [March 21, 2020, 11:15pm UTC](https://discourse.psychopy.org/t/getting-written-responses/11630/2 "2020-03-21T23:15:43Z")

</div>

> [@GIULIA\_SFRISO](#):
>
> The issue is that when I press “backspace”, “return” or “space” on the keyboard, it seems to work but then the key name appears on the screen.

1. That seems contradictory. What does “it seems to work” mean?

2. To understand what is going wrong in code like this, it is useful to insert some _**(temporary)**_ debugging code at strategic points. e.g.

and check that it matches your expectations at that point in the code.

---

<div class="post-metadata">

**Author:** ![Omidrezaa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/omidrezaa/32/6105_2.png) [@Omidrezaa](https://discourse.psychopy.org/u/Omidrezaa)\
**Post date:** [March 22, 2020, 6:42am UTC](https://discourse.psychopy.org/t/getting-written-responses/11630/3 "2020-03-22T06:42:38Z")

</div>

Hi @GIULIA_SFRISO

I had the same problem with a similar code. However, I used the code from the post below and it worked:

> [@Writen response](https://discourse.psychopy.org/t/writen-response/4676/2):
>
> Hi @alba, a simple solution involves using text and code components in Builder. Have one component display text called e.g., displayText, and another called e.g., copyText In the code component, add the following code to the relevant tabs. Note, the shift keys to capitalize are not working at this point. Begin Experiment import string allLetters = list(string.ascii\_lowercase) Begin Routine textFill = '' Each Frame keys = event.getKeys() if 'escape' in keys: core.quit() # So you can quit…
