| Reference | Downloads | Github

Mouse Click not Registering

I’ve tried reading through almost every thread I can find and still cannot figure out why this basic code doesn’t work. Basically, I am trying to load up an image, create rectangle polygons over them to define a clickable space, and advance the routine on once clicked. however, to know that clicking is working, I’ve been trying to turn the color to red. Here is what I have so far in my trials routine:

Begin Experiment

Mouse = event.Mouse(visible=True,newPos=None,win=Choice_Window)

Begin Routine

Choice_Screen = visual.ImageStim(Choice_Window, image = "Choice_CB.png", pos=[0,0], units = "pix", size = [1280,720])

Left_Rect = visual.Rect(win=Choice_Window, pos=(-260,-40),size=(365,460),opacity=0.5,fillColor=Colour, units = "pix")
Right_Rect = visual.Rect(win=Choice_Window, pos=(260,-40),size=(365,460),opacity=0.5,fillColor=Colour, units = "pix")


Each Frame

if Mouse.isPressedIn(Left_Rect):
      Left_Rect.color = 'red'

However, when I click on the left rectangle nothing happens. If i then define the mouse click in the builder instead of code, clicking actually causes a crash with the following error:
ValueError: Monitor blank has no known size in pixels (SEE MONITOR CENTER)

Any help appreciated.