• Could not connect to Twitter

Simple easygui User Input (enterbox)

Following on from the fileopenbox example I’ll show you how to replace raw_input with an input-dialog in 2 lines of Python, using Stephen Ferg’s easygui module. No other modules are needed, easygui is cross-platform.

Text-input box with a default string:
import easygui
result = easygui.enterbox(message="Enter your name", title="Name query", argDefaultText="Ian Ozsvald")

Anything the user types in is returned as a string, if the user hits Cancel then None is returned.

The resulting dialog looks like this on Windows:

Related: easygui has an integerbox just for numerical input.

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.

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 Yes/No Input (boolbox)
  2. Simple easygui File Dialogs
  3. New Python ShowMeDos (German): RurPle and EasyGUI by Python Kids
  4. Digg adds Screencast for user-education
  5. New ShowMeDo: Practical Episode – User Interface Basics

3 comments to Simple easygui User Input (enterbox)