Hello,
For a couple of hours I try to figure out how write a simple straightforward code which says: In case you click on a given rectangular box shown on the screen, another rectangular box appears on a new screen. If you click on the other rectangular object, another box appears on a new screen.
I came up with the following code which however is insufficient:
import sys
import random
from psychopy import visual,event,core,gui
# definitions
win1 = visual.Window([1370,710], color= 'black', units = 'pix')
timer = core.Clock()
mouse= event.Mouse()
def BOX():
box2 = visual.Rect(win1,lineColor="black",fillColor="LightGreen",size [300,150],pos=[0,-160])
box2.draw()
box5 = visual.Rect(win1,lineColor="black",fillColor="Blue",size=[300,150],pos=[0,160])
box5.draw()
win1.flip()
mouse
def keys():
if mouse.isPressedIn(box2):
box4 = visual.Rect(win1,lineColor="black",fillColor="LightBlue",size=[100,50],pos=[-200,-90])
box4.draw()
win1.flip()
elif mouse.isPressedIn(box5) :
box6 = visual.Rect(win1,lineColor="black",fillColor="Pink",size=[100,50],pos=[220,-90])
box6.draw()
win1.flip()
BOX()
keys()
Optimally the mouse click code should also work for pad touch screen,
Any piece of advice would be very much appreciated.
Best,
Tiber