Sunday, November 17, 2024
Google search engine
HomeLanguagesPython EasyGUI – Continue Cancel Box

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 terminated, below is how the continue cancel box looks like

In order to do this we will use msgbox method Syntax : ccbox(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 continue and cancel Return : It returns True if continue is pressed else False

Example : In this we will create a continue cancel 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 = "You want to learn more about EasyGUI ?"
 
# title of the window
title = "GfG - EasyGUI"
 
# creating a continue cancel box
output = ccbox(message, title)
 
# if user pressed continue
if output:
     
    # message / information to be displayed on the screen
    message = "Go to Lazyroar to learn more about EasyGUI"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)
 
# if user pressed cancel
else:
     
    # message / information to be displayed on the screen
    message = "Ok No Problem"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)


Output :

Another Example : In this we will create a continue cancel box with new text for the cancel and continue 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 = "You want to learn more about EasyGUI ?"
 
# title of the window
title = "GfG - EasyGUI"
 
# button names
choices = ["Let's Go", "End This !"]
 
# creating a continue cancel box
output = ccbox(message, title, choices)
 
# if user pressed continue
if output:
     
    # message / information to be displayed on the screen
    message = "Go to Lazyroar to learn more about EasyGUI"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)
 
# if user pressed cancel
else:
     
    # message / information to be displayed on the screen
    message = "Ok No Problem"
  
    # title of the window
    title = "GfG - EasyGUI"
  
    # creating a message box
    msg = msgbox(message, title)


Output :

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments