Beforehand I might add that I am fairly experienced in programming Python, but I am completely new to JavaScript, so please be specific. Thanks
Description of the problem:
I have created an experiment using the PsychoPy builder. There, I wanted a more sophisticated dialog than the “basic” ones that are created with the gui.DlgFromDict()-function. So, in the experiment settings, I set the “Show Info dialog” to false. Then, I created a code component and coded in Python in the Before Experiment-section something as in the following:
myDlg1 = gui.Dlg(title="Info")
myDlg1.addText('Some text here.\n')
myDlg1.addText('Some more text')
myDlg1.addField('A question with choices', choices=['A','B','C','others'])
myDlg1.addText('Please give your date of birth')
myDlg1.addField('Day', choices=[*range(1,32)])
myDlg1.addField('Month', choices=[*range(1,13)])
myDlg1.addField('Year', choices=[*range(1920,2020)])
ok_data = myDlg1.show() # show dialog and wait for OK or Cancel
if myDlg1.OK: # declare variables and maybe ask further questions
Subject = {'Info1':ok_data[0],
'Birth':str(ok_data[1])+'.'+str(ok_data[2])+'.'+str(ok_data[3])}
# if Info1 is not given explicitly, ask further questions
InfoForSpecification = 'others'
if Subject['Info1'] == InfoForSpecification:
myDlg1_1 = gui.Dlg(title="further Info")
myDlg1_1.addText('Please be more specific:')
myDlg1_1.addField('')
ok_data_specific = myDlg1_1.show() # show dialog and wait for OK or Cancel
if myDlg1_1.OK: # declare variables
Subject['Info1'] = InfoForSpecification + ': ' + ok_data_specific[0]
else:
core.quit() # the user hit cancel so exit
else:
core.quit() # the user hit cancel so exit
All together there are up to 4 dialog boxes that the user must click through before the actual experiment starts, but you get the idea from this section. It all works perfectly offline. Now I wanted to upload the project and pilot it on pavlovia. There, I always get one of the following errors:
TypeError: psychoJS.gui.Dlg is not a constructor
or
TypeError: psychoJS.gui.Dlg is not a function
when I tried something as in the following:
myDlg = new psychoJS.gui.Dlg({"title": "Basic Params for Image Localiztion"});
So, my actual question is: Does the function psychoJS.gui.Dlg() exist and how can I call it? Or do I have to settle with the slightly limited possibilities of psychoJS.gui.DlgFromDict()?