interactave, readline, and insert_text

garett asdf at asdf.asd
Fri Jul 30 12:53:23 EDT 2004


Hello, I have been trying to make a function that will print a line of
text to the edit line of the interactive interpreter so that I can modify
the line and then hit enter. I have been using readline.insert_text().
However, the line does not show up in the edit line. After googleing
around for this I found a post that suggested:
def test():
	readline.insert_text("asdf")
	x = readline.get_line_buffer()
	print x

the resulting output is:
test()asdf

So, the text does get inserted into the line buffer but does not display
in the edit line of the interactive interpreter.

I have also tried readline.redisplay() to the the contents of the line
buffer to display in the edit line of the interpreter. Does anybody have
any suggestions as to a technique to put text into the edit line of the
interactive interpreter from a function so it can be further edited?
Thanks a lot. -Garett



More information about the Python-list mailing list