Newbie: raw_input and other input methods
Randall Hopper
aa8vb at yahoo.com
Mon Nov 29 08:20:45 EST 1999
Hassan Aurag:
|However when I wanted to have a nifty prompt like the following one:
|
|raw_input("\033[0;34mInput: \033[0m"), I was surprised it got all
|screwed up.
|
|This is true if you run this anywhere (gnome-terminal, vt without
|X...). It won't know the real size of terminal, because it thinks
|len("\033[0;34mInput: \033[0m") = 24 instead of what is really there
|and that is 7.
|
|This means that line wrapping won't work on your first line!
|
|My question is:
|
|Is there another input method a la raw_input (not like input that
|evals also) that can be mixed with readline and still sees that string
|as it is.
Well, an easy fix you probably thought of is to end your prompt string with
'\n'. ;-) That is, do input on the line following the prompt.
|Or, is there any workaround?
Don't know. A curses module may have what you need. Too bad raw_input
doesn't support a line-length parameter, or you could just override the
default.
--
Randall Hopper
aa8vb at yahoo.com
More information about the Python-list
mailing list