Adding dialogue input text boxes into a psychopy experiment?

553 views
Skip to first unread message

Jeremy Ward

unread,
Aug 1, 2016, 6:22:08 AM8/1/16
to psychopy-users

I am using psychopy and python to program a simple psychology experiment. Basically, a foreign word appears on the screen for 8 seconds, followed by 5 seconds of a translation of that word. During the 8 second exposure to the foreign word, participants are instructed to type in a guess as to what the translation might be. When they start typing, their text appears underneath the foreign word that is being displayed on the screen.

Here is my question; how can include a dialogue, input text box in my experiment underneath the foreign word where they type and their letters appear, rather than just appearing beneath the word with no border or boundary?

Oliver Clark

unread,
Aug 2, 2016, 5:45:33 AM8/2/16
to psychopy-users
Hi Jeremy,

By setting fullScreen to False and allowGui to True when the window is set, you can use a dialogue box to present words and collect responses.

In a code component set:

Begin Experiment:
from psychopy import qtgui as gui

Begin Routine:
yourDictName = {'foreignWord':word, 'translation':''} #create a dictionary for the dlgBox to draw from - the entry translation takes words from a conditions file.

dictDlg = gui.DlgFromDict(dictionary = yourDictName, title = 'Translation', fixed = ['foreignWord'])
if dictDlg.OK:
    continueRoutine = False

End Routine:
trials.addData('translation', info['translation']) #adds participant's translation to the csv file - trials is the loop to which the conditions file is associated

End result is:


However - I can't find an option to set the position of the dialogue box - so it doesn't appear centred - anyone else got an idea on this?

Cheers,

Oli
Reply all
Reply to author
Forward
0 new messages