Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Python EasyGUI – Enter Box
Next article icon

Python EasyGUI – Integer Box

Last Updated : 12 Apr, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

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 :

https://media.geeksforgeeks.org/wp-content/uploads/20200904021929/Window-Title-GfG-2020-09-04-02-19-05.mp4

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 :

https://media.geeksforgeeks.org/wp-content/uploads/20200904022403/Window-Title-GfG-2020-09-04-02-23-18.mp4

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

https://media.geeksforgeeks.org/wp-content/uploads/20200904022513/Error-2020-09-04-02-23-31.mp4


Next Article
Python EasyGUI – Enter Box

R

rakshitarora
Improve
Article Tags :
  • Python
  • Python-EasyGUI
  • Python-gui
Practice Tags :
  • python

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
  • Python EasyGUI – Boolean Box
    Boolean Box : It is used to display a window having a multiple options i.e buttons in EasyGUI, it can be used where there is a need to get if the first selection option as it returns 1 for button having index 0 and for other button it returns 0, it is slightly different from index box, below is how
    3 min read
  • EasyGUI – Multiple Enter Box
    Multiple Enter Box : It is used to get the multiple input from the user at the single time, inputs can be any keyboard input, it takes inputs in form of string. It displays the title, message to be displayed, a group of places to enter a text and a pair of "Ok", "Cancel" button which is used confirm
    3 min read
  • Python EasyGUI module - Introduction
    EasyGUI is a module for very simple, very easy GUI programming in Python. EasyGUI is different from other GUI generators in that EasyGUI is NOT event-driven. Instead, all GUI interactions are invoked by simple function calls. Unlike other complicated GUI's EasyGUI is the simplest GUI till now. Insta
    2 min read
  • Python - Create a box in GTK+ 3
    Prerequisite - Python - Creating window, button in GTK+ 3 In GTK+ rather than specifying the position and size of each widget in the window, you can arrange your widgets in rows, columns, and/or tables. The size of your window is determined automatically, based on the sizes of the widgets it contain
    2 min read
  • Python EasyGUI – Showing Image in a Button Box
    In this article we will see how we can add or show image in the button box. Button box is used to display a window having multiple buttons in EasyGUI, it can be used where there is condition to select one among lot of buttons for example buttons in lift at a time user can opt only one option, below
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences