| Reference | Downloads | Github

Dialog box element access


Dear All,
I am having bellow mentioned dialog box where I can select the channel for the olfactometer. In my application, I can select a channel from the drop-down list and It activates that particular channel. For that, I must access that particular selection. How can do that? Thanks in advance.

from __future__ import absolute_import, division, print_function
from psychopy import gui  #fetch default gui handler (qt if available)
## you can explicitly choose one of the qt/wx backends like this:
## from psychopy.gui import wxgui as gui
## from psychopy.gui import qtgui as gui

# create a DlgFromDict
info = {'Observer':'jwp', 'Channel':['1','2','3','4','5','6','7','8'],
'Time (sec)':45, 'ExpVersion': 1.1, 'Debug Mode': True}
infoDlg = gui.DlgFromDict(dictionary=info, title='TestExperiment',
order=['ExpVersion', 'Observer'],
tip={'Observer': 'trained visual observer, initials'},
fixed=['ExpVersion'])  # this attribute can't be changed by the user
if infoDlg.OK:  # this will be True (user hit OK) or False (cancelled)
   print('User Cancelled')


Hi @RaviMevada, if you want to access the information from the info dict used to populate your gui, you can use the following in a code component, anywhere in the experiment.

myChannel = info['Channel']

This will output the selection made for Channel into a variable for later use.


Thank you very much. Now it is working the way I wanted.