gian848396 gian848396 - 1 year ago 76
Python Question

How do I make an easygui Multi Enter Box?

How do I make an easygui Multienterbox with all of the questions below in one window?

namegui = easygui.enterbox(msg='Enter your name', title='Name query', default='Gian')
baigui = easygui.enterbox(msg='Enter your BAI', title='Burns Anxiety Inventory query', default='Gian')
bdcgui = easygui.enterbox(msg='Enter your BDC', title='Burns Depression Checklist query', default='Gian')
yeargui = easygui.enterbox(msg='Enter the current year', title='Current Year', default='2011')
monthgui = easygui.enterbox(msg='Enter the current month', title='Current Month')
daygui = easygui.enterbox(msg='Enter the current day', title='Current Day')
time_hourgui = easygui.enterbox(msg='Enter the current hour', title='Current Hour')
time_minutegui = easygui.enterbox(msg='Please enter current minutes', title='Current Minute')
am_pmgui = easygui.enterbox(msg='Please enter either am or pm', title='AM OR PM')

I am using Python 2.5.1 on Mac OS X Snow Leopard(10.6).

Answer Source

The EasyGui Tutorial has a section on using multienterbox. You an put all of your field names in a list (fieldNames = ['Name query','Burns Anxiety inventory query',...]) and pass it to multienterbox along with a window title (title) and a message (msg):

fieldValues = multenterbox(msg,title, fieldNames)

If you still need the values in individual fields, you could then unpack your tuple:

# include one variable name for each value in fieldValues
namegui, baigui, bdcgui = fieldValues