It looks like there was a change in 2024.1.0 such that the gui dialog system started doing everything with dictionaries rather than lists, including adding fields and storing data: RF: Handle dlg data as a dict · psychopy/psychopy@0b8c718 · GitHub
Notably this includes the fact that “addField” now requires a key when called, and “label” is now an optional argument, rather than the key serving as the label. “addText” is now “addFixedField”.
This was not a well-documented change. The documentation for the gui.dlg function (psychopy.gui - create dialogue boxes — PsychoPy v2024.2.1) provided in the example is no longer viable and needs to be updated. I’ll throw in a github issue about that.
So the dialog declaration in your code needs to be something like:
dlg = gui.Dlg(title="PatHons", labelButtonOK=u' OK ', labelButtonCancel=u'', pos=(200, 400)) # Cancel (decline to answer all)
dlg.addField('age', label=questions[0])
dlg.addField('gender', label=questions[1], choices=[ 'Man','Woman','Trans and/or gender diverse','I use a different term','Decline to answer'])
dlg.addField('language',label=questions[2], choices=[ 'English','Arabic','Pali','Hebrew','Farsi','Chinese','Korean','Japanese','Other','Decline to answer'])
dlg.addField('fluent', label=questions[3], choices=[ 'Yes','No','Decline to answer'])
thisInfo = dlg.show() # you have to call show() for a Dlg (automatic with a DlgFromDict)
And on the other end, you need to refer to each field by its key rather than an index. So,
thisInfo['age']