# Keyboad events bug

**URL:** <https://discourse.psychopy.org/t/keyboad-events-bug/47068>\
**Category:** Coding\
**Created:** [May 1, 2026, 4:11pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068 "2026-05-01T16:11:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lazar](https://avatars.discourse-cdn.com/v4/letter/l/eada6e/32.png) [@lazar](https://discourse.psychopy.org/u/lazar)\
**Post date:** [May 1, 2026, 4:11pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/1 "2026-05-01T16:11:11Z")

</div>

dear psychopy

I would like to let you know that 2024 version of psychopy has a keyboard handling bug which causes misses of the “press” keyboard events. Have to actually press a button for 10-20 times before it gets detected.

the 2022 version does not have this problem.

Best wishes

LF

---

<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:** [May 1, 2026, 5:10pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/2 "2026-05-01T17:10:39Z")

</div>

Do you have a keyboard component AND event.getKeys() in code?

---

<div class="post-metadata">

**Author:** ![lazar](https://avatars.discourse-cdn.com/v4/letter/l/eada6e/32.png) [@lazar](https://discourse.psychopy.org/u/lazar)\
**Post date:** [May 1, 2026, 7:21pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/3 "2026-05-01T19:21:52Z")

</div>

in the “time line” editor, I add two “trial” blocks

the first one has a text “hello” shown for 10s and a keyboard which waits for a button press.  
the second one has a text “bye” for 3s.  
the idea is as soon as a button is pressed, the slide advances…

in 2022 version, the task works correctly and responds to a button press.  
in 2024 version, the first slide sits for 10 seconds as it cannot get a button press..  
(well, If I press 10-20 times, eventually it gets is)

the actual py-code is generated automatically…

---

<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:** [May 1, 2026, 8:03pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/4 "2026-05-01T20:03:32Z")

</div>

This sounds like the non-slip timing error. Try setting the max duration in Routine Settings. I’ll link to a relevant post later if you haven’t sorted it out.

---

<div class="post-metadata">

**Author:** ![lazar](https://avatars.discourse-cdn.com/v4/letter/l/eada6e/32.png) [@lazar](https://discourse.psychopy.org/u/lazar)\
**Post date:** [May 1, 2026, 8:16pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/5 "2026-05-01T20:16:00Z")

</div>

Please, elaborate, I am not sure what “non-slip timing error” is.

---

<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:** [May 2, 2026, 9:41am UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/6 "2026-05-02T09:41:57Z")

</div>

> [@Routine doesn't advance after mouse/slider response, forced end of routine enabled, duration fixed](https://discourse.psychopy.org/t/routine-doesnt-advance-after-mouse-slider-response-forced-end-of-routine-enabled-duration-fixed/45887/2):
>
> There is an issue with “non-slip” timing. I find that the best way to deal with it is for components to have no duration (i.e. blank) and then end the routine using routine settings (with non-slip timing unchecked)

---

<div class="post-metadata">

**Author:** ![lazar](https://avatars.discourse-cdn.com/v4/letter/l/eada6e/32.png) [@lazar](https://discourse.psychopy.org/u/lazar)\
**Post date:** [May 2, 2026, 8:08pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/7 "2026-05-02T20:08:30Z")

</div>

I would like to thank you for the link. it is very educational and some of the “artefacts” described there (like black screen) I have also  
observed. The practical recommendation to leave each component duration blank and use “routine settings” → flow-\> duration (if I understood correctly) to set one common duration is an interesting one.

However, there is still no explanation of what “non-slip timing” is and the provided link does not appear to be relevant (at least  
without an explanation how it is relevant). I found this link

> **[Non-slip timing for imaging — PsychoPy v2026.1.3](https://psychopy.org/general/timing/nonSlipTiming.html)**

which again does not explain what “non-slip timing” is, but maybe it means an accumulation of time-related errors.

on that page, it is not clear how/why waiting until a timer has reached a certain value relates to a screen refresh period.  
Unfortunately, again even if it is true (for some strange reason), I do not understand how this might be related to “missing” keyboard events.

keyboard events are “latched” by the operating system which means that once an event is generated it is stored in a buffer/queue until it is has been read or cleared.

Since I observe a massive loss of “press” buttons events, there is a mechanism which clears the buffer/queue without checking it.  
it is a bug…  
as I said earlier, in 2022 version, the effect is not observed.  
so there appears to be a problem caused by changes between the two versions

LF

---

<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:** [May 4, 2026, 3:19pm UTC](https://discourse.psychopy.org/t/keyboad-events-bug/47068/8 "2026-05-04T15:19:46Z")

</div>

I don’t think your keyboard event is missing. I think that it is ending the routine (screen goes black) but failing to move on to the next routine (because the routine is set to a fixed duration). The solution I give here tells PsychoPy not to fix the duration of this routine.
