psychopy.org | Reference | Downloads | Github

Size of visual.Window() is influenced by dialogue box

dialog
screen

#1

I am using Psychopy v1.85.3 (standalone version) on a win10 Laptop.

My problem: I noticed that the size of visual.Window() is influenced by whether I display a dialogue box before setting up a window. (This troubles me because I fear that the distortion will impact the size of my elements on screen.)

Let me illustrate with an example in code:

from psychopy import core, visual, gui

for i in ['Without preceeding GUI', 'With preceeding GUI']:
    
    if i == 'With preceeding GUI':
        # INFO DIALOGUE
        dict = {'Item:':False}
    
        dlg = gui.DlgFromDict(dict, 'Preceeding GUI')
    
    
    # define a window
    win = visual.Window(
        size=(1536, 864), fullscr=True, screen=0,
        allowGUI=False, allowStencil=False,
        monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
        blendMode='avg', useFBO=True,
        units='cm'
        )
    
    print 'win.size[0] = ', win.size[0] 
    print 'win.size[1] = ', win.size[1]
    
    win.close()
    
core.quit()

This gives me the output:

##### Running: D:\scalingProblem.py #####
win.size[0] =  1536
win.size[1] =  864
1.4637 	ERROR 	avbin.dll failed to load. Try importing psychopy.visual
  as the first library (before anything that uses scipy)
  and make sure that avbin is installed.
win.size[0] =  1920
win.size[1] =  1080
3.8151 	WARNING 	User requested fullscreen with size [1536  864], but screen is actually [1920, 1080]. Using actual size

So, on the first run of the loop my screen size seems to be [1536, 864] and on my second it turns to [1920, 1080]. How is that possible and what does that mean?

What can I do to go sure that a lenght of one with units = ‘cm’ (for any visual object) will really be a centimeter on screen even after displaying a dialogue box?

Thank you for your help!


#2

I can’t replicate your issue.

But I have to ask, why are you requesting a window size that is incompatible with the window being full-screen? Surely if you just ask for a window that is 1920 × 1080 full screen, there wouldn’t be a problem?

i.e. you are feeding incompatible information to the function when creating the window so it is perhaps not surprising that things will go awry (although, as I say, it doesn’t replicate on my system).


#3

Thank you for your answer :slight_smile:
I don’t know what might be different from my laptop to yours since I am new to programming. Did you run it with win10 as well?

If I don’t specify a window size, the default is win.size = (800,600), which is even less correct (see output below). :grimacing: That is why, I thought I would just specify the size of my screen. I tried to find out the size of my screen with win32api:

import win32api

print 'width: ', win32api.GetSystemMetrics(0)
print 'height: ', win32api.GetSystemMetrics(1)

# INFO DIALOGUE
dict = {'Item:':False}
dlg = gui.DlgFromDict(dict, 'Preceeding GUI')


# define a window
win = visual.Window(
    fullscr=True, screen=0,
    allowGUI=False, allowStencil=False,
    monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
    blendMode='avg', useFBO=True,
    units='cm'
    )

print 'width: ', win32api.GetSystemMetrics(0)
print 'height: ', win32api.GetSystemMetrics(1)

core.quit()

But this code also gives me different outputs before and after I use a dialogue box:

##### Running: D:\scalingProblem.py #####
width:  1536
height:  864
width:  1920
height:  1080
2.7749 	ERROR 	avbin.dll failed to load. Try importing psychopy.visual
  as the first library (before anything that uses scipy)
  and make sure that avbin is installed.
3.8936 	WARNING 	User requested fullscreen with size [800 600], but screen is actually [1920, 1080]. Using actual size

I could just let PsychoPy use the actual size and trust the setting win.fullscr = True. But in my experiment, I specify sizes in “cm”, and I want to be sure that these sizes are not skewed when I include a dialogue box at the beginning of my experiment. Can I trust PsychoPy there?

My screen has the folowing measures: 39,62 cm (15,6”), 1.920 x 1.080 pixel, Full HD.


#4

In Windows, are you running your screen at a non-native resolution (i.e. 1536 × 864 rather than 1920 × 1080)?


#5

I had the recommended scaling (1920 x 1080).

There was one other setting for the size of text, apps and other elements, which was set to 125% (recommended; see below). When I change this to 100% my output of the code above is width: 1920 height: 1080 before I call the dialogue box and width: 2400 height: 1350 after I call the dialogue box. So, the starting point is different (1920 x 1080), but the behaviour of the dialogue box, i.e. modifying the resolution, is the same.
Could this be relevant?