The center of the visual window is shifted the the lower right on the extension display on MAC

Hi all,

I’m using a MacBookPro which runs MacOS 10.13.6
My PsychoPy version is 3.1.0

When I run an experiment using the MacBook’s own screen, everything’s fine, but when I display the experiment on an extension screen, strange thing happens.

Say the window size is 800x600, for some reason, PsychoPy seems to assume the content size to be 1600x1200, and only displays the upper-left portion of the “whole” content. That is, what should be in the center of the window is shifted to the bottom-right of the window.

Here’s the lines of code that I create the window:
win = visual.Window(size=aspect,screen=1, allowGUI=False, color=‘black’, monitor=“testMonitor”)

when I attempt to rescale and reposition the center by adding “viewPos=(-0.5,0.5)” to the argument, I get the error message:
AttributeError: ‘NoneType’ object has no attribute ‘close’

What could be going on?

The code works perfectly on Windows os, I don’t know how can this happen to MAC.

Thank you!

Part of that is a known issue with Retina displays. See my old post below. Pyglet has this problem where sometimes it uses actual pixels and sometimes it uses retina ‘points’ (which are 2 normal pixels), and sometimes it multiplies everything by 2 to get from one to the other, but it only does that multiplication for some parts of the window and not others. It’s a mess, I’ve been trying to figure it out for a while with limited success.

The viewPos error I don’t know. It sounds like something is trying to close and re-open the window before it’s created, but I’d have to look at the window code to be sure. Does that part of the code work on Windows?

Hi Jon,

Thanks for the link!

viewPos doesn’t work on Windows, either. It yields the same error message.

Meanwhile, viewScale affects visual.ImageStim and visual.Rect (and perhaps other visual.something) objects, but not visual.TextStim. I thought it should rescale everything in the window, including the texts. Is it intended to have no effect on TextStim objects?

OK, so viewPos is just bugged right now (heads up @jon @mdc). viewScale I’m not sure. It would certainly be more intuitive if it affected text stimuli, but I’m not sure what’s going on there.

I’m currently looking into it. I think I fixed some retina related issues in the development branch, however I’m looking at cases in this thread too.

In the next few weeks I’m going to be overhauling PsychoPy’s handling of window buffers. If the changes are approved, I’m pretty sure no one will be encountering retina related issues again.

  • mdc
1 Like

I have an idea about what’s going on there with viewPos. I’m not sure why this is a problem since the window transforms are not updated unless the context changes. They are applied after the frame flips and are not changed/cleared unless you explicitly tell it to.

  • mdc

Please try the new release of PsychoPy to see if these issues have been resolved and report back. I re-worked the logic associated with how viewports and transformations are handled. These issues seem to have been resolved in my tests, but it would help to see if they have been resolved under different configurations.

Just got back to where I can test this. 3.1.2 is still having some major issues with external displays using a retina mac. This is what I get by running the demo screensAndWindows with both displaying on the external monitor


If I try to have one on the retina display and one on the external, the one on the retina display works just fine, the external one appears but is completely blank and does not animate.

One improvement is that if I have the external plugged in but tell both to render on the retina display, they’re fine. That used to also be screwy. However, I think we’re still running into some fundamental limitations with Pyglet’s canvas.

1 Like