Changing image on keypress
Hi,
I am trying to program a test trial where participants can change the image that is displayed on the screen.
To choose the image I would really like for them to scroll through a set of images by pressing a button (e.g. press 'a' to show img_x and press 'l' to show img_y) and then when they decide press 'enter' to move on.
I am trying to do something similar to the BART experiment, i.e. where a participant presses a button such as 'spacebar' and the image increases in size. But instead of increasing in size, during a trial the actual image changes. Once the participant has decided on which image they want, they then press 'enter' and the specific image choice is logged. I have 10 images, named 1.png, 2.png etc.
I know this will require some in-line coding, with if statements, but I just can't figure out how to do it, my programming skills are beginner only.
Any help would be much appreciated!
Thanks,
James

Comments
Hi James,
Sounds like fun. Here my implementation. Let me know if it does what you want.
I made it with letters because I haven't had images, but it should be doable to adjust. Basically get the path for each image like so:
path = exp.pool[u'image_in_pool.png'], and store all the paths in a list. And later draw the images withmy_canvas.image(path,x=x)instead of withcanvas.text(). See also here: http://osdoc.cogsci.nl/3.1/manual/python/canvas/#function-canvas46image40fname-centertrue-xnone-ynone-scalenone41Good luck.
Eduard