Keypress duration as Sketchpad Duration
Hi all,
I'm aware that my question may have a ridiculously simple answer but I'm not able to find a working solution on my own.
As the title says, I need to present a sketchpad for as long as the participant presses a key.
In other words I will present sketchpad1 and it will remain on the screen until the participant presses a key. Then, sketchpad2 will be shown until the participant releases the key. In that moment, sketchpad3 will appear for some miliseconds and then the loop will start again.
I've looked at this other related threads:
- http://forum.cogsci.nl/index.php?p=/discussion/comment/7979/
- http://forum.cogsci.nl/index.php?p=/discussion/206/solved-key-realease
- http://forum.cogsci.nl/index.php?p=/discussion/comment/4712
But I have not been able to get it to work.
Thanks!

Comments
Hi shamshir,
set "duration" to infinite.
put a keyboard_response item afterwards.
http://osdoc.cogsci.nl/3.1/manual/response/keyboard/
Greetz
Stephan
Hi DahmSF,
Thanks for answering! When I do what you mentioned, i'm not able to obtain the effect that I'm looking for. I would like to just press a key one time to go from sketchpad1 to sketchpad3. Let me explain again because now that I'm reading what I posted, it looks a bit confusing.
I want to present a image (sketchpad1) until the participant makes a keyboard response. So, I set the duration of sketchpad1 to "0" and I put a keyboard-response afterwards. When a key is pressed (the space bar in my case), sketchpad2 will appear. During how much time? Well, as long as the participant presses the key. Then, when the participant releases the key, sketchpad2 should vanish and sketchpad3 should appear and remain in the screen for some miliseconds. Then the trial is ended and another sketchpad1 appears to begin a new one.
I've looked in the documentation and I couldn't find any "release" key responses, but looking at the threads that I mentioned in the previous post, I've been able to construct a simple code that nearly reaches my goal. The only problems are that I just have to use sketchpad1 and sketchpad2 without the third one in order for it to work, and it skips the last trial (I guess because the loop element is over and the code only is on the loop element and not in the rest of the experiment).
The code:
Regards
Javi
Hi Javi,
Your code looks already promising. If you add the presentation of the second stimulus, you should be set. Can you try it?
Does this make sense?
Eduard
Hi Eduard,
Your code could totally solve my problem, but I have the 3 canvas as 3 different sketchpads with variables and such. How do I link the specific sketchpads inside my loop and not other sketchpads that have the same name, that are presented in other parts of the experiment?
Thanks a lot for your answer!
Regards
Javi
Ok, I've "discovered" this function:
my_canvas = self.copy_sketchpad('my_sketchpad')If I'm not mistaken, this lets me copy a given Sketchpad as a canvas, once it has already been prepared.
My first question regarding this is, do I lose information like how much time a given sketchpad is supposed to be shown? If so, how do I specify the time of a canvas?
My second question is how should I edit the sketchpads so that they are only shown when the code says? Can I set their condition on the sequence to "never" so that they are prepared but only shown like the code from Eduard specifies?
I'm sorry if I'm missing something very obvious
Thanks a lot!
Regards
Javi