psychopy.org | Reference | Downloads | Github

Bringing experiment to full screen after some loops

Hi,

I’m coding an experiment with PsychoJS and I had a problem with bringing experiment to full screen.

The experiment starts with

psychoJS.openWindow({
    fullscr: false,
    color: new util.Color('black'),
    units: 'norm'
});

I need to bring the window to full screen after a loop. So in the scheduler function of the full screen loop, I added

psychoJS.window.adjustScreenSize();

According to the source code this should be the function. But it doesn’t seem to work. There is also no log related to window size such as ‘Unable to go fullscreen’ or 'Resizing Window: ’ in console.

I have also tried having a dedicated scheduler just for this function. But it’s still the same.

Please let me know where I should put this function and if I missed something here.

Thanks!
Yu Li

It looks like this function should work since it is used by the core.gui API when a window is opened with “fullscr: true”:

// switch to full screen if requested:
self._psychoJS.window.adjustScreenSize();

Has anyone have experience calling this function in their experiment?

After digging around a bit more I found out that the “adjustScreenSize()” checks window.fullscr before bringing the window to full screen. Should have check this function first.

For anyone who wants to enable/disable fullscreen after initialization, window.fullscr needs to be set along with adjustScreenSize() or closeFullScreen().

Please could you give the exact JS code you used for JavaScript novices? I feel like I wouldn’t know what to type in the JS window without further research.