I’m new to Psychopy. I added a code that makes a square polygon appear on the screen when I press the space key, stays on the screen for the time the key is pressed, and goes off the screen when the key is released. I have two separate routines for this process. My polygon component is the same in both routines. Both have code component at the bottom. The begin routine part of the first has
myClock = core.Clock()
and each frame section:
if defaultKeyboard.getKeys([‘space’], waitRelease=False, clear=False):
#print(“Got key press”)
In the each frame part of the second one, this is written;
if defaultKeyboard.getKeys([‘space’], waitRelease=True):
The system I created works technically. The problem is that when I put these in the loop, the codes do not work as the first stimulus of the loop, the polygon appears on the screen before I press the space key, and when I press it, it disappears directly from the screen. But in the continuation of the loop it works as it should. So it doesn’t give any error. Can you help me on how to solve this problem? Thank you very much in advance for your help.