Multi Password Box : It is used to get the input from the user which is in form of multiple text and single password i.e masked input, input can be any keyboard input, it takes input in form of string. It displays the title, message to be displayed, group of places to enter a text and a pair of “Ok”, “Cancel” button which is used confirm the input. Also we can set some default text to the place where user enter text. It is similar to multi enter box but last entry field is considered as password i.e masked text below is how the password box looks like
In order to do this we will use multpasswordbox method Syntax : multpasswordbox(message, title, fields, 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 fields and forth is list of string which is default text Return : It returns the list of entered text and None if cancel is pressed
Example : In this we will create a multi password box with default text, and will show the specific message on the screen according to the entered text, below is the implementation
Python3
# importing easygui module from easygui import * # message to be displayed text = "Enter the details to go further" # window title title = "Window Title GfG" # list of entry fields fields = ["Email ID ", "Geek ID ", "Password"] # default text default_values = ["email@abc.com", "G - 111 ", "password"] # creating a multi password box output = multipasswordbox(text, title, fields, default_values ) # showing details entered by the user print ("Details entered by user") print (" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ") # traversing the output for i in range ( len (fields)): # showing field and entered value print (fields[i] + " : " + str (output[i])) |
Output :
Details entered by user ================================== Email ID : email@asd.ccc Geek ID : G-11122 Password : password
Another Example : In this we will create a multi password box without default text, and will show the specific message on the screen according to the entered text, below is the implementation
Python3
# importing easygui module from easygui import * # message to be displayed text = "Enter the details to go further" # window title title = "Window Title GfG" # list of entry fields fields = ["Email ID ", "Geek ID ", "Password"] # creating a multi password box output = multipasswordbox(text, title, fields) # showing details entered by the user print ("Details entered by user") print (" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ") # traversing the output for i in range ( len (fields)): # showing field and entered value print (fields[i] + " : " + str (output[i])) |
Output :
Details entered by user ================================== Email ID : aaa Geek ID : Geek101 Password : alphabeta