Retrieving window's size

Hi @Irfa_Nisar, this thread and this thread should help you.

psychoJS.window.size returns an array [w, h].

You can add a code component in the"Begin Experiment" tab:
JS code:

w = psychoJS.window.size[0];
h = psychoJS.window.size[1];

where ‘w = psychoJS.window.size[0]’ stores the first item in the array (which is width) as w, and ‘h = psychoJS.window.size[1]’ stores the second item in the array (height) as h, which are now variables that can be used elsewhere. Looks like this may return size in pixels though.

If the goal is to present consistently sized images across different monitor dimensions, you can incorporate @wakecarter’s credit card demo found here. This demo should be helpful for seeing how to store online screen size and access in python.

Cheers!

1 Like