# Making a holding period for pressing a button in PsychoPy

**URL:** <https://discourse.psychopy.org/t/making-a-holding-period-for-pressing-a-button-in-psychopy/33862>\
**Category:** Other\
**Tags:** screen, buttons\
**Created:** [March 16, 2023, 9:30am UTC](https://discourse.psychopy.org/t/making-a-holding-period-for-pressing-a-button-in-psychopy/33862 "2023-03-16T09:30:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ignat\_Davydov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/ignat_davydov/32/13042_2.png) [@Ignat\_Davydov](https://discourse.psychopy.org/u/Ignat_Davydov)\
**Post date:** [March 16, 2023, 9:30am UTC](https://discourse.psychopy.org/t/making-a-holding-period-for-pressing-a-button-in-psychopy/33862/1 "2023-03-16T09:30:46Z")

</div>

Dear colleagues,

I am currently interning at the Potsdam University where I am involved in a Spatial Cognition Project. In our research, participants are presented with a circle and a white button in the center of the screen (see the pic). In each trial, participant here an audio file with a number (e.g. “five”, “two”, etc.) and they are asked to indicate with their finger (participants conduct the experiment on a big sensor screen) where the number is located at the circled (as if the circle is a clockface). After they indicated the number in the circle, they need to press the central button to start a new trial. I have made the experiment, but my professor asked to make some changes.

First, I need to make participants not just pressing the button in the center but to replace it with a holding period, i.e., participants should press the central “button” and hold it for a while, e.g., during 200 ms, to initiate.

And second, I need to abort all the trials in which participants release the central “button” too early (e.g., within the first 100 ms after the audio file starts) and an error message should appear. As far as I understand, I need to use coder for that, but I have no clue what I should put into it.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/3/5/35a30e6d8db32e5df3119b2f08684d578f5a569d.png)

---

<div class="post-metadata">

**Author:** ![frankgarcea](https://avatars.discourse-cdn.com/v4/letter/f/258eb7/32.png) [@frankgarcea](https://discourse.psychopy.org/u/frankgarcea)\
**Post date:** [March 16, 2023, 1:19pm UTC](https://discourse.psychopy.org/t/making-a-holding-period-for-pressing-a-button-in-psychopy/33862/2 "2023-03-16T13:19:23Z")

</div>

Hi Ignat,

Some time ago I posted about using button de-press to capture RT.

> [@Recording RT from button de-press](https://discourse.psychopy.org/t/recording-rt-from-button-de-press/31613):
>
> Hi all, Each trial of my task is initiated with a button press (e.g., press and hold the space bar). E.g., participants press and hold the space bar, an image is then presented, and they release the space bar given task instructions. I’m wondering if it is possible to use button de-press as a marker of RT. Any input would be greatly appreciated. Thanks, FG

This may not be the final solution but it may help you out.

FG
