如何制作 easygui 多输入框?

发布于 2024-12-11 06:52:11 字数 1009 浏览 0 评论 0原文

如何制作一个 easygui Multienterbox,在一个窗口中包含以下所有问题?

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

我在 Mac OS X Snow Leopard(10.6) 上使用 Python 2.5.1。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬花如无物 2024-12-18 06:52:11

EasyGui 教程有一个关于使用 multienterbox。您可以将所有字段名称放入列表中 (fieldNames = ['Name query','Burns Anxiety inventory query',...]) 并将其传递到 multienterbox 以及窗口标题 (title) 和消息 (msg):

fieldValues = multenterbox(msg,title, fieldNames)

如果您仍然需要各个字段中的值,则可以解压元组:

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

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
无人接听 2024-12-18 06:52:11

这是工作示例

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

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))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文