psychopy.org | Reference | Downloads | Github

gui.DlgFromDict never returns

Hello everyone,

I have an anaconda PsychoPy3 installation with psychopy 1.90.2 and python 3.5 on MacOS High Sierra. The only additional packages I installed are pylink and h5py.

When I try to present a dialogue box from dictionary, e.g.:
dlg = gui.DlgFromDict({‘One Item’: False,
‘Two Items’: True})
the command just hangs and it never returns. The dialogue is not presented on the screen at all.

Has anyone had similar experience? Any ideas what could cause this error? I do not get any errors, the code just hangs until I terminate it.

Hi @draran, are you using Coder? If you run only the following, no other code, does it still hang?

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from psychopy import gui
dlg = gui.DlgFromDict({'One Item': False, 'Two Items': True})

Hi @dvbridges and thanks for the suggestion. While your snippet works well, the issue does not seem to be related to the character encoding.

Rather, the issue seems to have to do with how different packages in psychopy interact. Only when I import visual and/or event packages from psychopy, the dlg.DlgFromDict() does not return.
This works:
import core (and/or import monitors, tools, logging)
import gui
gui.DlgFromDict()

This does not work:
import visual (and/or import event)
import gui
gui.DlgFromDict()

Any suggestions there? @jon?

Thats ok @draran, it was not about the encoding, I just wanted to get a minimum working example.

My guess is that this is a problem with wxpython clashing with pyglet (which is used for events and visual stimuli).

psychopy.gui will try to use PyQt if available (because that doesn’t normally have this issue). If PyQt isn’t available then it will use wx instead. So if you install PyQt (or just use standalone) I think it will be fine

Thanks @jon, that worked.

Perhaps the installation instructions on the webpage (Anaconda/Miniconda) could be updated so as to list PyQt5 as one of the dependencies, e.g.:

pip install PyQt5

Cheers