Window freezes when running with multiple screens

II just installed psychopy (2021.2.3) and tried to run the following demo code.

from psychopy import visual, core
win = visual.Window([400,400])
message = visual.TextStim(win, text='hello')
message.autoDraw = True  # Automatically draw every frame
win.flip()
core.wait(2.0)
message.text = 'world'  # Change properties of existing stim
win.flip()
core.wait(2.0)

This crease a window on a non-primary monitor. The window stays blank. Trying to move the window turns it into “not responding”. There is no error visible in the Runner. See image.

When disconnecting my other monitors and running on a single monitor the code does work.

How can I get it to work on multiple monitors?

I assume this is on Windows 10?

First, try just running it a second time. I’ve had issues like this in the past where just running the code twice fixes it for some reason, it might have to do with the initialization of some kind of backend rendering thing.

Second, try specifying the screen:

win = visual.Window(size=[400,400], screen=1)

That should at least open the window on the other screen.

Finally, if that doesn’t work, in your display settings switch which one is the “primary” monitor. There might be a mismatch in what Windows thinks the “primary” monitor is and what PsychoPy thinks.

A combination of the two solutions suggested did the trick.

It turns out that it only works on my main display, but that it automatically defaulted to my second display. Thus providing the screen parameter, forcing the window to appear on my main display did the trick. Changing my main display (to what was original my off screen) and assigning the appropriate screen parameter allows me to run it on the other screen.

Dear PsychoPy Community,

Recently, we also encountered the issue where a window couldn’t be successfully opened on a non-primary monitor. Your suggested solution, which involved setting the external monitor as the primary monitor and changing the screen, did work. However, this isn’t the ideal solution for us. Our preference is to utilize a non-primary monitor for the experiment. Currently, we’re facing this problem specifically in Windows 11, whereas it wasn’t an issue in Windows 10.

Are you aware of any existing issues in Windows 11 that could cause this? Any guidance or potential solutions you could provide would be immensely appreciated. If there’s no immediate solution, our only recourse might be to revert our computer back to Windows 10. This issue is impacting both PsychoPy and Psychtoolbox.

Thank you for any assistance you can offer.

Best regards,
Till