[open] Random Placement of Image in Sketchpad
Hello,
Apologies if this question has already been asked and resolved, but I am trying to create a Choice-Reaction Time experiment (a picture appears and a second or two later a dot appears in one of five places [top right, bottom right, top left, bottom left and centre] and the participant has to click on the dot - longer RTs = more interest in the picture).
I'm struggling to find out how to get this dot to present after a period of time and in one of the five places, randomly. Is it to do with the 'show if =' statement in the sketchpad?
Thanks!
Comments
Hi,
Answer to your question: no. The
show ifstatement is to indicate the condition under which your sketchpad must be shown. We can assume that you want to show your sketchpad regardless of condition, so it's better left at the default setting ("always").I think it's better to use an inline_script. With inline_scripts you would have to write some code, but it's the most straightforward way to implement certain manipulations, such as presenting a dot at a random location. Have a look here: http://osdoc.cogsci.nl/python/canvas/
The canvas function substitutes for the sketchpad. What you further have to do, is indicate the five possible dot positions (x and y coordinates). You could make a list containing the five positions as follows:
positions = [[10,10], [20,20], [20,40], [40,20], [40,40]](note that these coordinates don't make sense!). Picking a random position and placing it on your canvas goes as follows:Hope this helps. Good luck!
Josh