Creates a dialogue box that represents a dictionary of values. Any values changed by the user are change (in-place) by this dialogue box. e.g.:
info = {'Observer':'jwp', 'GratingOri':45, 'ExpVersion': 1.1}
infoDlg = gui.DlgFromDict(dictionary=info, title='TestExperiment', fixed=['ExpVersion'])
if infoDlg.OK:
print info
else: print 'User Cancelled'
In the code above, the contents of info will be updated to the values returned by the dialogue box.
If the user cancels (rather than pressing OK), then the dictionary remains unchanged. If you want to check whether the user hit OK, then check whether DlgFromDict.OK equals True or False
A simple dialogue box. You can add text or input boxes (sequentially) and then retrieve the values.
see also the function dlgFromDict for an even simpler version
Example:
from psychopy import gui
myDlg = gui.Dlg(title="JWP's experiment")
myDlg.addText('Subject info')
myDlg.addField('Name:')
myDlg.addField('Age:', 21)
myDlg.addText('Experiment Info')
myDlg.addField('Grating Ori:',45)
if myDlg.show()==gui.OK:
thisInfo = myDlg.data
print thisInfo
else: print 'user cancelled'
A simple dialogue allowing access to the file system. (Useful in case you collect an hour of data and then try to save to a non-existent directory!!)
If initFilePath or initFileName are empty or invalid then current path and empty names are used to start search.
If user cancels the None is returned.
A simple dialogue allowing access to the file system. (Useful in case you collect an hour of data and then try to save to a non-existent directory!!)
If initFilePath or initFileName are empty or invalid then current path and empty names are used to start search.
If user cancels the None is returned.