Hiding mouse for some componenets within the same routine

Ups, sorry. I changed the new core.Clock() to new util.Clock() in Begin routine JS side, and did not touch the PY code. It does not give any error in Pavlovia but the mouse is not invisible.

Have you still got the code relating to hiding the mouse?

Hello, yes

In begin routine:

In each frame:

I actually could not understand where exatly should I replace core.Clock() with new util.Clock()

  1. Delete all of those extra lines on the left hand side

  2. Change the code type from Auto to Both

  3. Change the myClock code on the JavaScript side only.

PY:
image

JS:
image

This does not give error but the cursor is not hidden in pavlovia

Try document.body.style.cursor=‘none’; instead of psychoJS.window.mouseVisible = false;

It worked! Though, the time was >=7 and the mouse was invisible after 7 secs.
Then I changed it to <=7 and =7, but this time it is invisible throughout the trial :smiley:

Please do try to understand the code you are using.

You need to set the mouse to none in Begin Routine and then auto after 7 seconds if you want it to be invisible for the first seven seconds.

You are right, so sorry. Now it works. Thanks a lot!

In case someone does not want to read all staff, here is the solution:

PY, begin routine:

myClock = core.Clock() 
win.mouseVisible = False
showMouse = False

PY, each frame:

if showMouse == False and myClock.getTime() >= 7: #will not be visible until 7 secs.
    win.mouseVisible = True
    showMouse = True

JS, begin routine:

myClock = new util.Clock();
document.body.style.cursor='none';
showMouse = false;

JS, each frame:

if (((showMouse === false) && (myClock.getTime() >= 7))) {
    document.body.style.cursor= 'auto';
    showMouse = true;
}