Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

15 views
Skip to first unread message

Stéphane Klein

unread,
Apr 2, 2012, 8:55:30 AM4/2/12
to pytho...@python.org
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
--
Stéphane Klein <step...@harobed.org>
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

Jean-Michel Pichavant

unread,
Apr 2, 2012, 9:54:48 AM4/2/12
to Stéphane Klein, pytho...@python.org
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/


JM

Stéphane Klein

unread,
Apr 2, 2012, 10:35:30 AM4/2/12
to pytho...@python.org
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

Grant Edwards

unread,
Apr 2, 2012, 10:45:32 AM4/2/12
to
On 2012-04-02, St?phane Klein <step...@harobed.org> wrote:
> Le 02/04/2012 15:54, Jean-Michel Pichavant a ?crit :
>> St?phane Klein wrote:
>>>
>>> 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
>>
>> Have a look at
>> http://excess.org/urwid/
>
> No, I don't look for high level feature based on ncurse?

For something simpler, your two best options are dialog and newt:

http://pythondialog.sourceforge.net/

https://en.wikipedia.org/wiki/Newt_%28programming_library%29
https://hurley.wordpress.com/2008/01/25/create-simple-ansi-based-ui-with-python-newt/
http://www.wanware.com/tsgdocs/snack.html

I'm rather partial to newt since it was intended from day 1 for use
with Python. It was written by RedHat many, many years ago for use in
their console-mode-installer (which was written in Python).

But, the docs are pretty sparse, and it's not very active these days.

> I would like very low level feature, form like sphinx quick start or
> modern-package-template?

Sorry, no clue what those are...

--
Grant Edwards grant.b.edwards Yow! Did I do an INCORRECT
at THING??
gmail.com

Jean-Michel Pichavant

unread,
Apr 2, 2012, 10:52:16 AM4/2/12
to Stéphane Klein, Python List
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}


JM

Stephane Klein

unread,
Apr 2, 2012, 3:41:38 PM4/2/12
to pytho...@python.org
Yes, quickstart.do_prompt is a good starting point :
https://bitbucket.org/birkenfeld/sphinx/src/164f59b2d946/sphinx/quickstart.py

--
Stéphane Klein <con...@stephane-klein.info>

J. Cliff Dyer

unread,
Apr 2, 2012, 3:52:34 PM4/2/12
to pytho...@python.org
You might look into formencode. It basically takes the philosophy that
a form is nothing more and nothing less than an interface between user
input and python data. It doesn't make assumptions about how you
present the form to the user. It just handles validation and conversion
of that data into useful python objects, and from python objects to
displayable values.

http://www.formencode.org/en/latest/Validator.html

Might be what you're looking for.

Cheers,
Cliff


On Mon, 2012-04-02 at 14:55 +0200, 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
> --
> Stéphane Klein <step...@harobed.org>
0 new messages