psychopy.org | Reference | Downloads | Github

Screen parameter not working for gui.DlgFromDict

Hello,

is it just me or is the screen parameter in the function gui.DlgFromDict not working?
It works correctly with visual.Window but the dialog box is always put on screen=1.

You can use this example for testing: screen_parameter_test.py (489 Bytes)

It would be important for me to fix this so that the subjects don’t see the input dialog. It is not possible to start the script prior the subject arriving because there are other scripts executed beforehand.

Thanks for your help!
Mario Reutter

That’s interesting. I didn’t know that was an option at all! There are two libs that can be used to create these dialogs; I wrote support for the wxPython one (which doesn’t have this parameter) and support for the Qt lib was added later by Sol who apparently added screen option.

You might be able to get it to work by tinkering with lines 307-315 in psychopy/gui/qtgui.py which is where the relevant code lies

Thanks, @jon!

I found the (very unlikely) bug: In our lab, we had to redefine screen 1 as primary screen in the Windows setup for various reasons (default: screen 0 = primary).
Lines 312 and 313 state: if self.screen <= 0: qtscreen = desktop.primaryScreen(). In my case, the result of desktop.primaryScreen() is 1, changing screen=0 to screen=1.

Thus, the solution was to simply change <= to < in line 312 of PsychoPy2\Lib\site-packages\PsychoPy-*current version*.egg\psychopy\gui\qtgui.py

1 Like