psychopy.org | Reference | Downloads | Github

Customizing the dialog box

screen
#1

My question concerns the extent to which the dialog box at the beginning of the experiment can be customized. In particular:

  1. Can items be selectively obligatory? For example, I would like to force my subjects to submit their participation code. As of now, you can start the experiment even if you leave all the items blank.

  2. Can the size of the dialog box be customized? I need to add more items and some of these are long questions. I fear that putting long questions in the dialog box will get it stretched over the screen without appropriate resizing.

Thanks!

#2
1 Like
#3

@rob-linguistics13, if you want fields to be required, you need to end each fieldname in the experiment settings with an asterisk. E.g., participant*. Ah, which is what Michaels link shows.

#4

Thank you both - I didn’t catch that topic in my search!

I can’t seem to put special characters (i.e., ? and parenthesis ( ) ) as part of the strings of the dialog box. Various pages suggest to use the backslash \ to escape those character, but when I try that, I get a blank screen. If I put double blackslashes, something like this will happen:

Did you live in the United States from birth until \(at least\) age 13?*

Any idea of how to have those characters as part of the input field of the dialog box?

I assume that resizing the dialog box is not possible. Is that correct?

#5

@rob-linguistics13, the size of the dialog box is not customizable, you can only add extra elements with different types of responses e.g., text, true/false or menu list options. As an alternative, you could add an extra routine where you collect types responses. Take a look at the input text demo, which shows how to present typed text onscreen locally and online:

https://pavlovia.org/run/demos/textinput/html/

1 Like
#6

Thank you for point this out, @dvbridges!!

I am also having trouble with this. I can’t see to print special characters as the key in the dictionary of expInfo, which is used by dlgFromDic for the dialog box. Any suggestion?

#7

@rob-linguistics13, I cannot seem to duplicate the error. When I add this line as a field for the dlg, I see the question presented in the dialog ok, and it also saves correctly as a header in the datafile.

#8

thanks for checking, @dvbridges! Would you mind sharing the line of code you used?

#9

Ah I was using the Experiment Settings dialog. The code for the online studies was simply:

let expInfo = {'participant': '', 'Did you live in the United States from birth until (at least) age 13?*': '001'};

// schedule the experiment:
psychoJS.schedule(psychoJS.gui.DlgFromDict({
  dictionary: expInfo,
  title: expName
}));

#10

Interesting. It seems that the special characters can be printed as part of the key of the expInfo dictionary as long as the associated value is not empty. So:

expInfo = {'participant': '', 'Did you live in the United States from birth until (at least) age 13?*': '001'};

works, but

expInfo = {'participant': '', 'Did you live in the United States from birth until (at least) age 13?*': ['Yes', 'No']};

does not (a black screen appears).

#11

Thanks for the info, I will have to check, but it is possible that drop downs are not yet supported in PsychoJS. I have created a GitHub issue requesting support for this functionality.

#12

Thanks. FYI, I have tested dropdowns in PsychoJS, and they do work unless there is a special character in their key.

1 Like