psychopy.org | Reference | Downloads | Github

Missing mouse clicks

OS: Win10
PsychoPy version: 1.84.2
Standard Standalone? (y/n): Y
What are you trying to achieve?: I have a fairly standard digit span task but I have participants click rectangles with the digits 1 through 9 to respond. Once clicked, the rectangles turn green and I get a variable for each digit pressed, maintaining their response and the order. The problem is that sometimes the mouse clicks aren’t registered, i.e., the issue doesn’t appear to be due to lag because waiting after clicking does nothing.

UPDATE: an older task that ran fine previously is now having issues—perhaps it is the computer, some program, or OS that is causing an issue?

What did you try to make it work?: I thought the issue might be the computers being slow or something but, in a dual task version I have where the second task is watching video clips, the videos play just fine. The issue appears to be in the response routine when I want participants to click. Either way, I tried using enumerate and time.sleep(0.001) as suggested in a post from a couple of weeks ago.

The program works just fine on my own MacBook Pro but still, I fear there might be something up with my code. Pasted below is the original code that works fine on my own laptop. In the each frame section of the response routine (note, “recs” is a set, so I only save unique values):

for rectangle in polygonList2:
    if mouse_11.isPressedIn(rectangle, buttons=[0]):
        RecNumb = polygonList2.index(rectangle)
        RecNumb = RecNumb + 1
        recs.add(RecNumb)
        rectangle.fillColor = 'green'
        if len(recs) == 1:
            num1Resp = RecNumb
        elif len(recs) ==2:
            num2Resp = RecNumb
        elif len(recs) ==3:
            num3Resp = RecNumb
        elif len(recs) ==4:
            num4Resp = RecNumb
        elif len(recs) ==5:
            num5Resp = RecNumb
        elif len(recs) ==6:
            num6Resp = RecNumb
        elif len(recs) ==7:
            num7Resp = RecNumb
        elif len(recs) ==8:
            num8Resp = RecNumb
        elif len(recs) ==9:
            num9Resp = RecNumb

    if mouse_11.isPressedIn(rectangle, buttons=[2]):
        RecNumb = polygonList2.index(rectangle)
        RecNumb = RecNumb + 1
        rectangle.fillColor = 'white'
        if len(recs) > 0:
            recs.discard(RecNumb)
        else:
            recs = set()

Any help would be greatly appreciated! conditions.xlsx (36.5 KB)
digiSpan.psyexp (74.5 KB)