EasyGUI - 多个输入框
多个输入框:用于一次获取用户的多个输入,输入可以是任意键盘输入,以字符串形式输入。它显示标题、要显示的消息、一组输入文本的位置和一对“确定”、“取消”按钮,用于确认输入。它类似于普通的输入框,但是在多个输入框中可以同时给出多个输入,下面是输入框的样子
In order to do this we will use multenterbox
method
Syntax : multenterbox(message, title, list_items, lust_default_text)
Argument : It takes 4 arguments, first string i.e message/information to be displayed, second string i.e title of the window, third is list of string i.e item name and forth is list of string which is default text
Return : It returns the list of entered text and None if cancel is pressed
例子 :
在此我们将创建一个带有默认文本的多输入框,并根据输入的文本在屏幕上显示特定的消息,下面是实现
# importing easygui module
from easygui import *
# message to be displayed
text = "Enter the following details"
# window title
title = "Window Title GfG"
# list of multiple inputs
input_list = ["Name", "Class", "Section", "Address"]
# list of default text
default_list = ["eg GfG", "XII", "A", "GeeksforGeeks"]
# creating a integer box
output = multenterbox(text, title, input_list, default_list)
# title for the message box
title = "Message Box"
# creating a message
message = "Enterted details are in form of list : " + str(output)
# creating a message box
msg = msgbox(message, title)
输出 :
另一个例子 :
这里我们将创建一个没有默认文本的多输入框,并根据输入的文本在屏幕上显示具体的信息,下面是实现
# importing easygui module
from easygui import *
# message to be displayed
text = "Enter the following details"
# window title
title = "Window Title GfG"
# list of multiple inputs
input_list = ["Geek Name", "Geek ID", "Experiance"]
# creating a integer box
output = multenterbox(text, title, input_list)
# title for the message box
title = "Message Box"
# creating a message
message = "Enterted details are in form of list : " + str(output)
# creating a message box
msg = msgbox(message, title)
输出 :