| Reference | Downloads | Github

Problems with gui dialog box on 1.85.2 (related to wxPython)


I’m on Windows 10 and just freshly installed the latest versions of Psychopy (1.85.2) and wxPython (4.0.0b1), but for the first time I’m getting problems making dialog boxes. Everything else in PsychoPy seems to work great.

Here’s the error I get whenever I try to make a dialog box:

Traceback (most recent call last):
  File "D:/Dropbox/Yale/Projects/Prototype Effect/code/", line 261, in <module>
    expInfo = enterSubInfo(expName)
  File "D:/Dropbox/Yale/Projects/Prototype Effect/code/", line 24, in enterSubInfo
    dlg = gui.DlgFromDict(dictionary=expInfo, title=expName, fixed=['dateStr'])
  File "C:\Python27\lib\site-packages\psychopy\gui\", line 249, in __init__
    Dlg.__init__(self, title)
  File "C:\Python27\lib\site-packages\psychopy\gui\", line 64, in __init__
    wx.Dialog.__init__(self, None, -1, title, pos, size, style)
TypeError: Dialog(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 4 has unexpected type 'NoneType'

Process finished with exit code 1

Here’s the code I’m using (which has worked on multiple operating systems, machines, and PsychoPy installations before):

def enterSubInfo(expName):  # GUI for entering experiment info
        expInfo = misc.fromFile(
            expName + '_' + '#' + '_' + 'lastParams.pickle')  # note the '#', for file-ordering purposes
        expInfo = {'Experiment': expName, 'Testing Location': '', 'Experimenter Initials': 'sdu',
                   'Subject Initials': '', 'Subject ID': '', 'Subject Age': '', 'Subject Gender': ''}
    expInfo['dateStr'] = data.getDateStr()
    dlg = gui.DlgFromDict(dictionary=expInfo, title=expName, fixed=['dateStr'])
    if dlg.OK:
        misc.toFile(expName + '_' + '#' + '_' + 'lastParams.pickle',
                    expInfo)  # note the '#', for file-ordering purposes

    return expInfo

expName = 'PE1'
expInfo = enterSubInfo(expName)

Any thoughts as to how I can fix the problem?


Your error

argument 4 has unexpected type 'NoneType'

is referencing the fixed = ['dateStr'] argument in the gui.DlfFromDict() function.

Essentially, it isn’t finding your key ‘dateStr’ in your expInfo dictionary, which means that the data.getDateStr() function isn’t returning anything, so the ‘dateStr’ key isn’t being created in the first place. To check, run:

expInfo['dateStr'] = data.getDateStr()
print data.getDateStr()
print expInfo.get('dateStr') 

and see what is returned. I don’t know where the .getDateStr() function comes from, but an alternative would be to use datetime64 objects from numpy.


@oguayasa’s idea is a good one but I don’t think that’s the problem (data.getDateStr() should always return a string, and if I insert None in its place the dialog still works for me).

I think the issue is the installation of wxPython 4.0.0. PsychoPy wasn’t compatible with wx4 at release 1.85.2. We’ve now got the repository working with that but you’ll have to wait for 1.86.0 to use wx4.0



Hello, I’m new with PsychoPy and I have this same problem when using gui to create a dialog box in my Mac, do you have any solution already?

Tank u