Windows中的python选项卡完成 [英] python tab completion in windows

查看:125
本文介绍了Windows中的python选项卡完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用python编写跨平台外壳程序,我想添加自定义制表符完成操作.在Unix系统上,当我按下TAB键时,我可以使用内置的readline模块并使用类似以下的代码来指定可能完成的列表:

I'm writing a cross-platform shell like program in python and I'd like to add custom tab-completion actions. On Unix systems I can use the built-in readline module and use code like the following to specify a list of possible completions when I hit the TAB key:

import readline
readline.parse_and_bind( 'tab: complete' )
readline.set_completer( ... )

如何在Windows上执行此操作?如果可能的话,我想避免依赖第三方包装.如果不存在解决方案,是否可以简单地按一下TAB键,以便我可以从头开始实现?

How can I do this on Windows? I'd like to avoid relying on 3rd-party packages if possible. If no solution exists is it possible to simply trap TAB key press so that I can implement my own from scratch?

推荐答案

您是否看过 PyReadline:适用于Windows的基于ctypes的阅读行?尽管不是第3方软件包,但对于自己构建一个软件包很有用,不是吗:).

Do u have a look at PyReadline: a ctypes-based readline for Windows? Although 3rd-party packages is NOT your option, maybe it's useful for build one's own, isn't it:).

这篇关于Windows中的python选项卡完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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