Simple Yes/No queries give us a simple way of asking the user for confirmation. Stephen Ferg’s easygui makes this easy with the ynbox. No other modules are needed, easygui is cross-platform. This follows-on from the enterbox and fileopenbox examples.
This code:
import easygui
result = easygui.ynbox(message = "Do you want to continue?", title = "Continue?")
# The dialog is modal and can't be Closed, you have to give an answer
# A Yes returns 1 (which is like True)
# A No returns 0 (which is like False)
generates this simple Yes/No dialog:

Related: easygui has a Continue/Cancel dialog (ccbox), a Boolean dialog (boolbox) and a multiple-button dialog (indexbox).
To see easygui’s fileopenbox, filesavebox, choicebox, enterbox and ynbox in action and learn how to write a Python program from scratch, visit: Python 101 – easygui and csv.
ShowMeDo has 113 Python videos and a latest-videos RSS feed.
If you enjoyed this post, make sure you subscribe to my RSS feed!Related posts:

