Python EasyGUI – Integer Box
Last Updated :
12 Apr, 2023
Integer Box : It is used to get the integer input from the user, input should be integer input not string 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 integerbox method Syntax : 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
Python3
# importing easygui module
from easygui import *
# message to be displayed
text = "Enter Something (integer)"
# window title
title = "Window Title GfG"
# default integer
d_int = 10
# lower bound
lower = 0
# upper bound
upper = 99999
# creating a integer box
output = integerbox(text, title, d_int, lower, upper)
# title for the message box
title = "Message Box"
# creating a message
message = "Entered Number : " + str(output)
# creating a message box
msg = 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
Python3
# importing easygui module
from easygui import *
# message to be displayed
text = "Enter a number !!"
# window title
title = "Window Title GfG"
# creating a integer box
output = integerbox(text, title)
# title for the message box
title = "Message Box"
# creating a message
message = "Entered Number : " + str(output)
# creating a message box
msg = 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
Similar Reads
Python EasyGUI â Enter Box 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 th
2 min read
Python EasyGUI - Message Box Message Box : It is used to display a window having a message or information in EasyGUI, it can be used where there is a need to display some message or some important information, it contains message and a "Ok" button which when pressed closes the message, below is how the message box looks like
2 min read
Python EasyGUI â Yes No Box Yes No Box : It is used to display a window having a two option yes or no in EasyGUI, it can be used where there is a need to get the answer of the question in form of yes or no, it displays two option yes or no for example when we want to ask user whether he is above 18 or not we will use yes no bo
3 min read
EasyGUI â Text Box Text Box : It is used to show and get the text to/from the user, text can be edited using any keyboard input, it takes input in form of string. It displays the title, message to be displayed, place to alter the given text and a pair of "Ok", "Cancel" button which is used confirm the text. It is simi
2 min read
Python EasyGUI â Multi Choice Box Multi Choice Box : It is used to display a window having a multiple options i.e items in EasyGUI, it can be used where there is a need to select multiple item among a group of items, it consist of title, message to be displayed, group of items and buttons i.e "Cancel", "Select All", "Clear All", "Ok
2 min read