Counting mouse clicks while click is held down

Hi @blund2, if you don’t care if a box was clicked twice (not counting multiple “clicks” without release) you could pragmatically fix this by only counting unique values in clicked_targs. Like this

for clickable in active_targs:
    if mouse.isPressedIn(clickable):
        clicked_targs.append(clickable.name)
        clicked_targs = list(dict.fromkeys(clicked_targs))
        thisExp.addData("clicked_targs", clicked_targs)
        nTargClicks = len(clicked_targs)
for clickable in active_dists:
    if mouse.isPressedIn(clickable):
        clicked_dists.append(clickable.name)
        clicked_dists = list(dict.fromkeys(clicked_dists))
        thisExp.addData("clicked_dists", clicked_dists)
        nDistClicks = len(clicked_dists)

If you care about “proper” multiple clicks, this might help: Prevent multiple mouse clicks when holding it