• Could not connect to Twitter

Simple easygui Yes/No Input (boolbox)

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.

Please share:
  • DZone
  • del.icio.us
  • Reddit
  • Furl
  • Ma.gnolia
  • email
  • StumbleUpon
  • Technorati
  • TwitThis
  • Slashdot
If you enjoyed this post, make sure you subscribe to my RSS feed!

Related posts:

  1. Simple easygui User Input (enterbox)
  2. Simple easygui File Dialogs
  3. Exercise and Solution 2 – Adding the About box and using HTML in wxPython
  4. ShowMeDo RSS Feeds
  5. New Python ShowMeDos (German): RurPle and EasyGUI by Python Kids

Comments are closed.