📜  Python EasyGUI - 继续取消框

📅  最后修改于: 2022-05-13 01:54:28.783000             🧑  作者: Mango

Python EasyGUI - 继续取消框

Continue Cancel Box :用于在 EasyGUI 中显示一个有两个选项 continue 或 cancel 的窗口,它可以用于需要显示两个选项 continue 或 cancel 的地方,例如当我们想确认选项是否按下 continue 时应用程序将继续前进,否则它将被终止,下面是继续取消框的样子

例子 :
在此我们将创建一个继续取消框,当按下任何按钮时,它将在屏幕上显示特定消息,以下是实现

# 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 GeeksforGeeks 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)

输出 :


另一个例子 :
在此我们将为取消和继续按钮创建一个带有新文本的继续取消框,当按下任何按钮时,它将在屏幕上显示特定消息,以下是实现

# 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 GeeksforGeeks 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)

输出 :