using curses with raw_input in python

ε祈祈猫儿з 提交于 2019-12-07 11:38:23

问题


In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality of raw_input function - arrow keys to move cursor / browse through the input history.

Is there a simple way to get such behavior working with curses, as it captures input events and I can't just use functions that read sys.stdin.


回答1:


Use curses.textpad

http://www.python.org/doc/2.4.1/lib/module-curses.textpad.html



来源:https://stackoverflow.com/questions/326922/using-curses-with-raw-input-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!