psychopy.org | Reference | Downloads | Github

Cannot adjust monitor size

Hi!

I am trying to set up my eye-tracking but ran into an issue concerning the monitor. The monitor I am using has a size of 1920x1080 pix. I can see that in the Monitor settings and also when I use the terminal:

$ system_profiler SPDisplaysDataType |grep Resolution

I get:

Resolution: 1920 x 1080 @ 60Hz (1080p)

I also read that retina displays can be a problem here, but I am not using a retina Display but the BenQ XL 2420 Z Monitor.

I set up the monitor in my python script for the experiment like that:

SCREENWIDTH = int(1920)
SCREENHEIGHT = int(1080)

m = monitors.Monitor("default", width=28.8, distance=200)
win = visual.Window(
    monitor=m,
    units="pix",
    winType="pyglet",
    size=[SCREENWIDTH, SCREENHEIGHT],
    fullscr=True,
    colorSpace="hex",
    color="#403841",
)

I am having trouble with monitors.Monitor because whatever I type in there, it does not seem to change anything about the monitor settings. I use the code suggested here to find out about the monitor being used. That looks like this:

for mon in monitors.getAllMonitors():
    print(mon, monitors.Monitor(mon).getSizePix())

and my output is always

testMonitor [1024, 768]

no matter what I write into the

m = ...

line. I tried writing the width of the screen there, too, but nothing changes.

Where does the testMonitor come from? Why is its resolution not as high as the actual monitor resolution? Where did my “default” Monitor go? Why isn’t it being listed when using getAllMonitors()?

The documentation does not really help me a lot as I do not understand what is meant by “calibration”; is it the eye-tracking calibration? I use pylink for that. It also does not explain the units expected as arguments. Shall I use pixels, inch, centimetres, millimetres, … as value for “width”?

Thank you in advance for you help!

OS: Mac
PsychoPy2 Standalone Version v1.85.6

Hi, the new monitor definition needs to be explicitly saved, e.g.

I guess the documentation could be changed to state this, as it seems to keep coming up as an issue…

These are stated in the documentation if you burrow down:

https://www.psychopy.org/api/monitors.html#psychopy.monitors.Monitor.setWidth

https://www.psychopy.org/api/monitors.html#psychopy.monitors.Monitor.setSizePix

Thank you for the answers!

I don’t get a warning that PsychoPy did not recognize my monitor.
mon.save() did not work; mon.saveMon() did, though.
When trying to save the monitor and listing them again with the method described above, I get the name but monitors.Monitor(mon).getSizePix() returns None.

After a while, I got the following error when creating the window: “window object has no attribute useNativeGamma” which confuses me because when looking up why others get that error, it’s usually because they were using a ner computer (which I didn’t). Could that have something to do with my attempts to save the monitor settings?

Hi @Vathiala ,

after you have created the Monitor
m = monitors.Monitor("default", width=28.8, distance=200)

you need to insert this line:
m.setSizePix((SCREENWIDTH, SCREENHEIGHT))

Also, to check for the correct resolution, don’t take the detour around the monitor center, just call m.getSizePix() directly.

(The correct call to the monitor center would have been: monitors.Monitor("default").getSizePix() since this is the name you gave the monitor in your call to monitors.Monitor. The name of the variable in which you store the result of the construction is irrelevant to the monitor center.)

Hope this helps!
Best regards,
Mario

I now changed the part to this:

m = monitors.Monitor("default")
m.setSizePix((SCREENWIDTH, SCREENHEIGHT))
m.setWidth(53.136) #screen width in cm
m.setDistance(66) # distance from eye to monitor in cm
m.saveMon()

win = visual.Window(
    monitor=m,
    units="pix",
    winType="pyglet",
    size=[SCREENWIDTH, SCREENHEIGHT],
    fullscr=FULLSCREENSETTING,
    colorSpace="hex",
    color="#403841",
)

And I don’t have the “useNativeGamma”-Problem anymore, either.

When calling

print(str(m.getSizePix()))

I get the height and width set above.
Thank you!

1 Like