psychopy.org | Reference | Downloads | Github

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.