Python EasyGUI – Enter Box
Last Updated :
12 Apr, 2023
Enter Box : It is used to get the input from the user, 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 enter box looks like
In order to do this we will use enterbox method Syntax : enterbox(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 enter box with default text, and will show the specific message on the screen according to the entered text, below is the implementation
Python3
from easygui import *
text = "Enter your Geek name !!"
title = "Window Title GfG"
d_text = "Enter here.."
output = enterbox(text, title, d_text)
title = "Message Box"
message = "Entered Name : " + str (output)
msg = msgbox(message, title)
|
Output :
Another Example : In this we will create a enter box, and will show the specific message on the screen according to the entered text, below is the implementation
Python3
from easygui import *
text = "Enter Something"
title = "Window Title GfG"
output = enterbox(text, title)
title = "Message Box"
message = "Entered string : " + str (output)
msg = msgbox(message, title)
|
Output :
Share your thoughts in the comments
Please Login to comment...