Python EasyGUI – Integer Box
Integer Box : It is used to get the integer input from the user, input should be integer input not sting which happens in enter box. It displays the title, message to be displayed, place to enter a integer input and a pair of “Ok”, “Cancel” button which is used confirm the input. We can set some default integer value to the place where user enter text and we can also set lower and upper bound value which user can enter, below is how the enter box looks like
In order to do this we will use
integerboxmethodSyntax : integerbox(message, title, default_integer, lower_bound, upper_bound)
Argument : It takes 5 arguments, first string i.e message/information to be displayed, second string i.e title of the window, third is integer which is default integer, forth and fifth are integer representing lower and upper bound respectively
Return : It returns the entered integer and None if cancel is pressed
Example :
In this we will create a integer box with default integer and with lower and upper bound value, and will show the specific message on the screen according to the entered integer, below is the implementation
# importing easygui modulefrom easygui import * # message to be displayedtext = "Enter Something (integer)" # window titletitle = "Window Title GfG" # default integerd_int = 10 # lower boundlower = 0 # upper boundupper = 99999 # creating a integer boxoutput = integerbox(text, title, d_int, lower, upper) # title for the message boxtitle = "Message Box" # creating a messagemessage = "Enterted Number : " + str(output) # creating a message boxmsg = msgbox(message, title) |
Output :

Another Example :
In this we will create a integer box and will show the specific message on the screen according to the entered integer, below is the implementation
# importing easygui modulefrom easygui import * # message to be displayedtext = "Enter a number !!" # window titletitle = "Window Title GfG" # creating a integer boxoutput = integerbox(text, title) # title for the message boxtitle = "Message Box" # creating a messagemessage = "Enterted Number : " + str(output) # creating a message boxmsg = msgbox(message, title) |
Output :
If we try to enter wrong input i.e string or number which don’t lie between the specified lower and upper bound an error message will keep appearing until correct input is entered



