I am using the standalone version of psychopy v1.85.3.
I have a large numbers of variables in my dialogue box and consequently the box is more at the bottom of my screen than in the middle. The class that I am using is:
psychopy.gui.Dlg(title=u'PsychoPy Dialog', pos=None, size=None, style=None, labelButtonOK=u' OK ', labelButtonCancel=u' Cancel ', screen=-1).
I read that there is no way to change the size of the dialogue box (https://discourse.psychopy.org/t/size-of-the-dialog-box/1150), but could I maybe change the position of the dialogue box? Simply changing the pos variable in does not do the trick.
Here is my code:
from psychopy import gui # INFO DIALOGUE expName = 'MTS_Kirst' # variables for the info dialogue: # addField(label ='', initial='', color ='', choices=None, tip='', enabled=True) expInfo_keyDefault = [ ('participant','','',None, 'participant name or code'), ('sex',None,'',('male','female', 'non-binary')), ('age','JJ','', None,'age of the participant in years'), ('nRuleSwitch_3C1', '1', '', None, 'for every n in nRuleSwitch both rules will be presented once in phase ThreeComparisons1') ] # my actual list is longer than that, so that the resulting dialogue box touches the bottom of the monitor dlg = gui.Dlg(title='Analogy_Kirst', pos=(0, 5)) # the change of pos does not lead to any change in the position of the dialogue for keyDefault in expInfo_keyDefault: # add headings if keyDefault == 'participant': dlg.addText('Subject Info', color = 'blue') elif keyDefault == 'nRuleSwitch': dlg.addText('Experiment Options', color = 'blue') # add fields dlg.addField(*keyDefault) # the splat operator passes the values of the tuple to the function expInfo_values = dlg.show() # returns a list with all the values; NOT a dict, so the keys are not included ''' 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. ''' if dlg.OK == False: core.quit() # user pressed cancel expInfo_keys = [i for i in expInfo_keyDefault] expInfo = dict(zip(expInfo_keys, expInfo_values))
Thank you for your help