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 – Boolean Box
Next article icon

Python EasyGUI – Yes No Box

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

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 box, it is kind of similar to continue cancel box, below is how the continue cancel box looks like

In order to do this we will use ynbox method Syntax : ynbox(message, title, choices) 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 list having exactly two values which is two option for yes and no Return : It returns True is yes is pressed else False

Example : In this we will create a yes no box, when any button is pressed it will show the specific message on the screen, below is the implementation 

Python3

# importing easygui module
from easygui import *
 
# message / information to be displayed on the screen
message = "Are you a Geek ?"
 
# title of the window
title = "GfG - EasyGUI"
 
# creating a yes no box
output = ynbox(message, title)
 
 
# if user pressed yes
if output:
     
    # message / information to be displayed on the screen
    message = "Thats Great !!"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)
 
# if user pressed No
else:
     
    # message / information to be displayed on the screen
    message = "You should become a Geek, go to GeeksforGeeks to become one"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)
     
    
                      
                       

Output :

https://media.geeksforgeeks.org/wp-content/uploads/20200903012108/GfG-EasyGUI-2020-09-03-01-20-35.mp4
https://media.geeksforgeeks.org/wp-content/uploads/20200903012128/GfG-EasyGUI-2020-09-03-01-20-44.mp4

Another Example : In this we will create a yes no box and setting specific choice for yes and no button, when any button is pressed it will show the specific message on the screen, below is the implementation 

Python3

# importing easygui module
from easygui import *
 
# message / information to be displayed on the screen
message = "Are you a Geek ?"
 
# title of the window
title = "GfG - EasyGUI"
 
# choices for yes and no button
choices = ["Agree", "Disagree"]
 
# creating a yes no box
output = ynbox(message, title, choices)
 
 
# if user pressed yes
if output:
     
    # message / information to be displayed on the screen
    message = "Thats Great !!"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)
 
# if user pressed No
else:
     
    # message / information to be displayed on the screen
    message = "You should become a Geek, go to GeeksforGeeks to become one"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)
     
    
                      
                       

Output :

https://media.geeksforgeeks.org/wp-content/uploads/20200903012322/GfG-EasyGUI-2020-09-03-01-22-59.mp4
https://media.geeksforgeeks.org/wp-content/uploads/20200903012128/GfG-EasyGUI-2020-09-03-01-20-44.mp4


Next Article
Python EasyGUI – Boolean 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 – Integer Box
    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 de
    3 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 – 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
  • 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
  • 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 – 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
  • 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
  • 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 t
    2 min read
  • Python EasyGUI – Continue Cancel Box
    Continue Cancel Box : It is used to display a window having a two option continue or cancel in EasyGUI, it can be used where there is a need to display two option continue or cancel for example when we want to confirm the option if continue is pressed application will move forward else it will get t
    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