Question

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).

Was it helpful?

Solution

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

OTHER TIPS

Here is the working example

def GetNameconfig():
   name = "TestInputValue"
   return name


defaultName = GetNameconfig()
msg = "Enter your personal information"
title = "Credit Card Application"
fieldNames = ["Name","Street Address","City","State","ZipCode"]
fieldValues = [defaultName, "Hauptstr. 1", "", "Germany", ""]
box = eg.multenterbox(msg,title, fieldNames, fieldValues)
print("Reply was: %s" % str(fieldValues))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top