在Python中使用curses与raw_input [英] using curses with raw_input in python

查看:113
本文介绍了在Python中使用curses与raw_input的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的python linux控制台应用程序中,我使用curses处理数据显示.同时,我想有一条输入线来输入命令,这几乎是一种很好的irssi风格.对于默认的curses getch(),我只需要做很多编码即可获得raw_input函数的基本功能-箭头键可移动光标/浏览输入历史.

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.

有没有一种简单的方法可以使这种行为与curses一起工作,因为它捕获了输入事件,而我不能只使用读取sys.stdin的函数.

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.

推荐答案

使用curses.textpad

Use curses.textpad

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

这篇关于在Python中使用curses与raw_input的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆