How to make pin stays on the scale

URL of experiment: BasketballRanking [PsychoPy]

Description of the problem: I’m trying to make a half-circle liker scale, almost there! I created a pin image and made the pin (orientation) trace the mouse. That’s how I made the pin move on the half-circle scale.

I want to implement the feature that participants click on the scale, and the pin stops tracing the mouse (when they make a decision) and then moves the mouse to the enter button to submit. Without this feature, the mouse points to the button and won’t stay on the scale where people decide.

I tried Each Frame

if (mouse.isPressedIn(scale)) {

But it didn’t work, the pin kept tracing the mouse. Any help!

Hi @Jun_Fang

The mouse.isPressedIn() function responds to holding the mouse down, not clicks, so you might need a few additional variables to track mouse.

In Begin Routine you initialize these variables:

decision_made = false; //records whether the participant has made a decision

In Each Frame you update these variables:

// only lock in pin location mouse was pressed in the scale
// and decision has not been made yet
if (mouse.isPressedIn(scale) && decision_made == false) {
  pin.setOri(degrees); //set pin location
  decision_made = true //lock decision

I don’t have enough details to reproduce your half-circle scale, so I wasn’t able to test the code above. Therefore, it may need further adjustments to suit the needs of your experiment.

Hope that helps,