# In new versions, dialog box functionality has been broken

**URL:** <https://discourse.psychopy.org/t/in-new-versions-dialog-box-functionality-has-been-broken/41036>\
**Category:** Coding\
**Created:** [August 9, 2024, 1:48am UTC](https://discourse.psychopy.org/t/in-new-versions-dialog-box-functionality-has-been-broken/41036 "2024-08-09T01:48:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [August 13, 2024, 1:31pm UTC](https://discourse.psychopy.org/t/in-new-versions-dialog-box-functionality-has-been-broken/41036/2 "2024-08-13T13:31:05Z")

</div>

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](https://github.com/psychopy/psychopy/commit/0b8c718b0c6f4eb89298ae3d3d00c270d727d891)

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](https://psychopy.org/api/gui.html)) 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:

```questions
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']`

---

_[View the full topic](https://discourse.psychopy.org/t/in-new-versions-dialog-box-functionality-has-been-broken/41036)._
