I look for a package to make some simple console "form"

Stephane Klein stephane at harobed.org
Mon Apr 2 15:41:38 EDT 2012


Le 02/04/2012 16:52, Jean-Michel Pichavant a écrit :
> Stéphane Klein wrote:
>> Le 02/04/2012 15:54, Jean-Michel Pichavant a écrit :
>>> Stéphane Klein wrote:
>>>> Hi,
>>>>
>>>> I look for a package to make some console "form".
>>>>
>>>> It's a standard stuff, I think there are a package to do that.
>>>>
>>>> Example :
>>>>
>>>> What is your name ?
>>>> Select your lang [EN, FR, DE…] ?
>>>> Do you want … [Y, N] ?
>>>>
>>>> Type of field :
>>>>
>>>> * textline
>>>> * select choice
>>>> * boolean question
>>>>
>>>> Thank for your help,
>>>> Stéphane
>>> Hi,
>>>
>>> Have a look at
>>> http://excess.org/urwid/
>>>
>>
>> No, I don't look for high level feature based on ncurse…
>>
>> I would like very low level feature, form like sphinx quick start or
>> modern-package-template…
>>
>> Regards,
>> Stephane
>>
> Don't know if there is such package. There's nothing that rawinput
> cannot handle in what you're asking for.
> Anyway since you refered to sphinx, it does not use any package, look at
> quickstar.py, you may reuse their do_prompt.
>
> And because being lazy is cool :
>
> from sphinx import quickstart
> d = {}
> quickstart.do_prompt(d, 'foo', 'enter the foo value', '5', lambda x:
> int(x))
> print d
> < {'foo': 8}

Yes, quickstart.do_prompt is a good starting point :
https://bitbucket.org/birkenfeld/sphinx/src/164f59b2d946/sphinx/quickstart.py

-- 
Stéphane Klein <contact at stephane-klein.info>
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com




More information about the Python-list mailing list