使用python在命令行上完成as-you-type [英] Complete as-you-type on command line with python
问题描述
我想在python中写一个小的应用程序/目录/文件启动器。
为了使它快,我想自动完成/ autosuggest条目。但我想显示
这些建议作为用户类型。从我已经阅读的readline模块完成是
只有可能使用完成热键,例如。标签。
I would like to write a small application/directory/file launcher in python. To make it fast i would like to autocomplete/autosuggest entries. But i want to display these suggestions as the user types. From what i have read about the readline module completion is only possible using a "Completion hotkey" e.g. Tab.
有任何建议吗?
使用下面建议的使用过滤器的curses似乎不起作用。这个最小示例清除我的屏幕,尽管调用filter():
Using curses with filter as suggested below does not seem to work. This minimal example clears my screen despite the call to filter():
import curses
curses.filter()
win = curses.initscr()
curses.noecho()
curses.cbreak()
while 1:
key = win.getkey()
win.echochar(key)
if key == "Q":
break
curses.endwin()
推荐答案
http:// docs。 python.org/2/library/curses.html
您有相关主题:
这篇关于使用python在命令行上完成as-you-type的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!