Wednesday, June 10, 2026
HomeLanguagesEasyGUI – Password Box

EasyGUI – Password Box

Password Box : It is used to get the input from the user which is in form of 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, place 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, below is how the password box looks like

In order to do this we will use passwordbox method

Syntax : passwordbox(message, title, default_text)

Argument : It takes 3 arguments, first string i.e message/information to be displayed, second string i.e title of the window and third is string which is default text

Return : It returns the entered text and None if cancel is pressed

Example :
In this we will create a password box with default text, and will show the specific message on the screen according to the entered text, below is the implementation




# importing easygui module
from easygui import *
  
# message to be displayed
text = "Enter the password to enterneveropen"
  
# window title
title = "Window Title GfG"
  
# default password
default_password = "neveropen"
  
# creating a integer box
output = passwordbox(text, title, default_password)
  
# title for the message box
title = "Message Box"
  
# creating a message
message = "Password entered by user : " + str(output)
  
# creating a message box
msg = msgbox(message, title)


Output :

Another example
In this we will create a password box without default text, and will show the specific message on the screen according to the entered text, below is the implementation




# importing easygui module
from easygui import *
  
# message to be displayed
text = "Enter the new password forneveropen"
  
# window title
title = "Window Title GfG"
  
# creating a integer box
output = passwordbox(text, title)
  
# title for the message box
title = "Message Box"
  
# creating a message
message = "Password entered by user : " + str(output)
  
# creating a message box
msg = msgbox(message, title)


Output :

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6896 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7018 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS