Mouse takes control despite "win.mouseVisible = False"

Sorry for the long winded intro:

I run an experiment in “standalone” mode ( library, etc.) where a visual task is performed. No mouse input needed and win.mouseVisible = False is set.
The experiment runs in a loop ( python code added ) and writes the result without personal identification to the CSV’s. Dependent on the task performance, we would like to get in touch with some of the people ( who triggered a decision mechanism inside the python code )
For those people, I bring up a special window with a TextBox to get their voluntary e-mail.

Here is the problem:
“every now and then” no text can be entered inside the textbox because somehow the Mouse became active ( and it is outside the TextBox ).

Again: no mouse is useed or needed during the entire experiment.
Is there something I am overlooking ? Has anybody seen this “random(?)” behaviour before ?

Thanks in advance


Why bring up a special window? Why not just use the existing one (in which case, no mouse problems should occur)?

Sorry, let be more clear:

when we see the person is “interesting to us”, we show a Background saying “please give us your info” and on that window, the textbox is a small element.

Other people do not get the request. Actually, other people go down a completely different “branch”. In Python, I added some decision to see if a part of the PsychoPy code is active or not.

By textbox, do you mean a visual.TextBox2 stim that you conditionally display within the psychopy experiment window to collect participant input?

If I understand correctly, sometimes the the textbox2 stim does not get focus, so text is not accepted by / entered into it, and you think this is because the system mouse cursor is becoming visible when it should not be? Is that right?

Could you provide a minimal example of your code that demonstates the issue so we can better look into it?

Thanks very much.

of course I can. I hope these are the parts you want to see.
I added comments.
this code runs in multiple locations and it is only in one that the problem occurred. Unfortunately, the person there is much less of a programmer than I am ( and I am not a programmer ). So, all I get is the verbal description ( including the “moved mouse into” )

Thanks in advance


(sorry for the length)

Early initialization:

GetMailString = visual.TextBox2(
 win, text=None, font='Arial',
 pos=(0, -0.1),     letterHeight=0.04,
 size=(1,.1), borderWidth=2.0,
 color='black', colorSpace='rgb',

Now inside the actual Program:

------Prepare to start Routine “Get_E_Mail”-------

continueRoutine = True
routineTimer.add(60) # timeout for e-mail

update component parameters for each repeat

mailstring =""
#needs to be intialized, otherwise contains all previous key-strokes
GetMailString.text =""

keep track of which components have finished

Get_E_MailComponents = [EMailBackground, GetMailString]
“”" more PsychoPy Code “”"

-------Run Routine “Get_E_Mail”-------

#-- My_get_Contact is based on earlier decision,
#-- My-Abandon just detected wether people left the unattended experiment

while continueRoutine and My_get_Contact == 1 and My_Abandon == False and routineTimer.getTime() > 0:
# get current time
t = Get_E_MailClock.getTime()
tThisFlip = win.getFutureFlipTime(clock=Get_E_MailClock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame

# The Background image: *EMailBackground* updates
if EMailBackground.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
    # keep track of start time/frame for later
    EMailBackground.frameNStart = frameN  # exact frame index
    EMailBackground.tStart = t  # local t and not account for scr refresh
    EMailBackground.tStartRefresh = tThisFlipGlobal  # on global time
    win.timeOnFlip(EMailBackground, 'tStartRefresh')  # time at next scr refresh

#GetMailString is using the textBox2 as seen in the initialization above

# *GetMailString* updates
if GetMailString.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
    # keep track of start time/frame for later
    GetMailString.frameNStart = frameN  # exact frame index
    GetMailString.tStart = t  # local t and not account for scr refresh
    GetMailString.tStartRefresh = tThisFlipGlobal  # on global time
    win.timeOnFlip(GetMailString, 'tStartRefresh')  # time at next scr refresh
mailstring = GetMailString.text
# CDO mailstring
final_mail =""
if mailstring.find("\n") > -1:
    final_mail = mailstring.rstrip("\n")
    continueRoutine = False

Hi Reiner,

Without being able to run the code that is causing an issue it is hard to give specific feedback or suggestions. I know some issues with TextBox2 text entry / focus have been fixed in the latest Psychopy source, which should be released within the next week or so.

I would be happy to test if the issue you experiencing has already been fixed if you send me (via private message) your full experiment with instuctions on how to run through it.

Thanks again.


no issue in sending you the code.

My “problem” is more that I can not reproduce it on my machine and thus feel I would be wasting your time unless something like this has come up with other people.

What the code does, is trying to understand some issues around color deficiency. For that Color Deficient are led down a different path than normal color vision.

In order to send you the test, I would have to include all the images and send everything via WeTransfer.

This is ongoing research, so you would please handle it accordingly.

Maybe you are simply also interested in some experiment on your color vision ? :blush:


Hi Reiner,

Thank you for the message.

My understanding is that an updated release of PsychoPy will be out sometime later this week or early next week. Maybe we should wait until that is released to see if the issue you are running into has already been fixed. If not, you can send me your experiment (I will not share it with anyone else) and we can go from there. Would that be OK?

Thanks again,