[PythonCE] Prompting the user for information

Stewart Midwinter stewart.midwinter at gmail.com
Wed Jan 18 18:32:35 CET 2006


On 1/18/06, Joshua Krohse <jkrohse at gmail.com> wrote:
>   If you know the function I am talking about, would you please share it?
> Also, any other methods of prompting for input would be useful.  This would
> be a good topic for a PythonCE Wiki page when there is one.

Joshua, you could try easygui.  It's a GUI tool for getting user input
in non-GUI programs.  It uses Tkinter, but without all of the overhead
you'd normally have.  You just use a one-liner to get the input.

#easygui-example.py
from easygui import *
import sys

while 1:
    msgbox("Hello, world!")
    msg ="What is your favorite flavor?"
    title = "Ice Cream Survey"
    choices = ["Vanilla", "Chocolate", "Strawberry", "Rocky Road"]
    choice = choicebox(msg, title, choices)
    # note that we convert choice to string, in case
    # the user cancelled the choice, and we got None.
    msgbox("You chose: " + str(choice), "Survey Result")
    msg = "Do you want to continue?"


cheers,
--
Stewart Midwinter
stewart at midwinter.ca
stewart.midwinter at gmail.com
Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad
AIM:midtoad1


More information about the PythonCE mailing list