The gui.DlgFromDict method (without sort_keys=False) in Psychopy2_Py2 renders the dialog box differently compared to Psychopy2_Py3.
Python2 renders the keys in arbitrary order while Python3 preserves the order.
This is due to the difference both Python versions deal with key order in the dictionary:
Quote from the Python2 docs:
CPython implementation detail: Keys and values are listed in an arbitrary order which is non-random, varies across Python implementations, and depends on the dictionary’s history of insertions and deletions.
This leads to 3 options in the Python2 version:
- alphabetical ordering
- random ordering
- force ordering by setting sort_keys=True and add an alphabetical increment for each label (eg 1), 2), … )
This makes gui.DlgFromDict not very flexible. Therefor, a suggestion is to enable the user to fix the order by applying a key order in the dict (eventually with a flag to tell gui.dlgFromDict to use the user-supplied key order.
An example:
expInfo = {'participant': [99, 0]
'type': [['healthy volunteer', 'patient'], 1],
'step size': [0.05, 2]
'factor': [10, 3]
'white noise volume': [ 0.2 , 4]
'log directory': ['logs', 5]
}
The second value of each parameter encodes the order of the parameters.