psychopy.org | Reference | Downloads | Github

Reducing cursor (or mouse) speed or increasing stimulus speed

Hello,

During my experiment, participants have to click mouse left button and drag circles while holding button but I have a problem: When I try to drag a circle, cursor speed is much more than stimulus speed and during dragging stimulus stop to follow cursor even though mouse button still clicked. I’ve uploaded a video in order to make clear my problem. I would be grateful for any advice.

PS: There is an invisible circle, that’s the reason of wierd situation (Circle B cannot move left) of Circle B begining 00:13. Please ignore it.

Still couldn’t find any solution. Can somebody help?

Hi There,

This one is an interesting one. I also replicated the issue you describe in the drag and drop demo in builder view, but only when I moved the mouse very quickly. I think a possible solution could be to play with the custom mouse component (https://www.psychopy.org/api/visual/custommouse.html) and set it so that it is rendered at the same time as the stimulus being dragged - can I check have you tried something like this already?

Becca

1 Like

Thank you, I had no idea about that. I’ll try ASAP…

do let us know how you get on! - I am curious!

1 Like

Unfortunatelly custommouse is out of my league. I tried it but couldn’t understand how to use especially I need to you mouse functions such as isPressedIn etc. Meanwhile, I’ve tried a few different way after custommouse failure in order to cope with this problem but always there was dead end.

Hi There,

can I ask have you had a try with the demo in view>coder>demos>input>customMouse.py

This could be a good place to start with learning a bit more about the parameters used.

Is your experiment for online or offline use?

Thanks,
Becca

1 Like

Today, I learned a new thing about Psychopy. I’ve just checked the demos in builder page. I’ll try a bit on this issue again. Thank you. I’ll inform you from new situations. I hope I’ll cope with this.

Meanwhile I’ll be appriciated if somebody help about my problem =)

Hi,

You might want to try out this example here. I remember that we had the same issue initially (and fixed it by adapting some code from @Michael, if I remember correctly).

Hope this helps.

Jan

2 Likes

The code in the example that Jan provided is explained here:

In essence, the mouse can move further than the boundary of your stimulus within one screen refresh, so it isn’t reliable to keep testing if the mouse is pressed within the stimulus. Instead, after the first time the mouse is pressed within a stimulus, you set a flag to indicate that a drag is under way, and just keep updating the stimulus position to match the mouse, until the mouse button is released.

3 Likes

Even though both replies work for me, Micheal’s is a bit detailed, thus I chose his answer as “solution”.

Dear @Becca, @jderrfuss and @Michael, thank you for your concern.

1 Like

Pleased you found a solution!! This is useful to know for future :slight_smile:

1 Like

Hey, no worries. @Michael wrote the code, so he certainly deserves the credit! :slight_smile:

Jan