Using gnu readline in my own python program?

Discussion in 'Python' started by sboyle55@yahoo.com, Aug 2, 2005.

  1. Guest

    Hi...I'm a newbie to python, and very confused. I'm writing a simple
    program and want the user to be able to edit a line that I display
    using the full gnu readline capabilitites. (For example, control+a to
    go to the beginning of the line.)

    Then I want to be able to read the line after it's been edited...

    I know that with perl I would do this with some variation on
    term::readline.

    I've looked at the readline and code packages under Python but I can't
    make heads or tails of them. The readline example in the docs is way
    over my head.

    Any ideas?

    Thanks
    , Aug 2, 2005
    #1
    1. Advertising

  2. Thomas Lotze Guest

    sboyle55 wrote:

    > Hi...I'm a newbie to python, and very confused. I'm writing a simple
    > program and want the user to be able to edit a line that I display using
    > the full gnu readline capabilitites. (For example, control+a to go to the
    > beginning of the line.)
    >
    > Then I want to be able to read the line after it's been edited...


    Probably the built-in function raw_input already does what you want. It
    uses readline if available.

    --
    Thomas
    Thomas Lotze, Aug 2, 2005
    #2
    1. Advertising

  3. Guest

    raw_input is an excellent suggestion, and almost exactly what I want.

    But, I want to give the user a string to edit, not have them start from
    scratch inputting a string.

    Any other ideas?
    , Aug 2, 2005
    #3
  4. Thomas Lotze Guest

    sboyle55 wrote:

    > raw_input is an excellent suggestion, and almost exactly what I want.
    >
    > But, I want to give the user a string to edit, not have them start from
    > scratch inputting a string.


    <http://svn.thomas-lotze.de/PyASDF/pyasdf/cli.py>

    Take a look at the fancy_input function.

    --
    Thomas
    Thomas Lotze, Aug 2, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter

    1 day gnu, whole life gnu?

    Peter, Jan 10, 2005, in forum: Java
    Replies:
    3
    Views:
    324
    John C. Bollinger
    Jan 10, 2005
  2. Peter
    Replies:
    17
    Views:
    589
    Chris Smith
    Jan 13, 2005
  3. Markus Elfring
    Replies:
    2
    Views:
    356
    Markus Elfring
    Feb 23, 2005
  4. Peter Otten
    Replies:
    0
    Views:
    503
    Peter Otten
    Jul 1, 2008
  5. gavino
    Replies:
    4
    Views:
    528
    gavino
    Sep 20, 2010
Loading...

Share This Page