# Keyboard component

**URL:** <https://discourse.psychopy.org/t/keyboard-component/46795>\
**Category:** Builder\
**Tags:** response\
**Created:** [March 12, 2026, 1:02pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795 "2026-03-12T13:02:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zahra.r](https://avatars.discourse-cdn.com/v4/letter/z/b4bc9f/32.png) [@zahra.r](https://discourse.psychopy.org/u/zahra.r)\
**Post date:** [March 12, 2026, 1:02pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/1 "2026-03-12T13:02:30Z")

</div>

If this template helps then use it. If not then just delete and start from scratch.

**OS** (e.g. Win10): macOS Tahoe 26.3.1  
**PsychoPy version** (e.g. 2024.2.4 Py 3.8): 2026.1.1  
**Standard Standalone Installation? (y/n)** If not then what?: y  
**Do you want it to also run online? (y/n) n**  
**What are you trying to achieve?: I want to collect keyboard response, with Allowed Keys being ‘y’ , ‘n’, but ‘y’ is never recorded.**

**What did you try to make it work?: I changed allowed keys to other letter and it works. Only ‘y’ is not accepted!**

**Link to the most relevant existing thread you have found: -**

**What specifically went wrong when you tried that?:**  
When running, if I input ‘y’ as an answer, it records None.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [March 12, 2026, 2:16pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/2 "2026-03-12T14:16:00Z")

</div>

Do you have any other keyboard components or keyboard code in Each Frame?

Please could you show a screenshot of your allowed keys?

---

<div class="post-metadata">

**Author:** ![Anoushka\_Sinha\_Roy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/anoushka_sinha_roy/32/46268_2.png) [@Anoushka\_Sinha\_Roy](https://discourse.psychopy.org/u/Anoushka_Sinha_Roy)\
**Post date:** [March 12, 2026, 2:51pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/3 "2026-03-12T14:51:48Z")

</div>

In GFMT experiment my correct response is coming as 0…making my test invalid.I have practical tomorrow.Can you please help me out?

---

<div class="post-metadata">

**Author:** ![zahra.r](https://avatars.discourse-cdn.com/v4/letter/z/b4bc9f/32.png) [@zahra.r](https://discourse.psychopy.org/u/zahra.r)\
**Post date:** [March 12, 2026, 2:53pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/4 "2026-03-12T14:53:48Z")

</div>

I don’t have any other keyboard components. Here are screenshots.

Another problem is that, while I have set the Allowed Keys to ‘set every repeat’, the error down there doesn’t go away: “Looks like your variable …”.

 ![Screenshot 2026-03-12 at 15.50.35](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/4/94702d54a57a824b522b1abbba0d1f9d5e693cea.jpeg)

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [March 12, 2026, 3:34pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/5 "2026-03-12T15:34:41Z")

</div>

Your allowed keys should be constant - they are always ‘y’, ‘n’

---

<div class="post-metadata">

**Author:** ![zahra.r](https://avatars.discourse-cdn.com/v4/letter/z/b4bc9f/32.png) [@zahra.r](https://discourse.psychopy.org/u/zahra.r)\
**Post date:** [March 12, 2026, 4:02pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/6 "2026-03-12T16:02:44Z")

</div>

Thank you, tried that too, still the same situation.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [March 12, 2026, 4:12pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/7 "2026-03-12T16:12:59Z")

</div>

Is your keyboard QWERTZ rather than QWERTY? If so, then does the keyboard component respond to Z and then Y if you set the allowed keys to ‘z’,‘n’ ?

---

<div class="post-metadata">

**Author:** ![zahra.r](https://avatars.discourse-cdn.com/v4/letter/z/b4bc9f/32.png) [@zahra.r](https://discourse.psychopy.org/u/zahra.r)\
**Post date:** [March 12, 2026, 4:44pm UTC](https://discourse.psychopy.org/t/keyboard-component/46795/8 "2026-03-12T16:44:33Z")

</div>

Yes! This solved it! Thanks so much!
