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.
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.subscribe to my RSS feed!