Python终端仿真
我希望在 Python 应用程序中运行一个与 xterm 兼容的虚拟终端。 我需要在其中运行基于 ncurses 的应用程序,向其提供用户输入并读取其输出。
到目前为止,我已经找到了 python-vte,但它只提供了 GTK+ 小部件(libvte 具有所需的 VtePty 类,但 Python 绑定没有)并且具有不可接受的 libgtk 依赖项。
还有其他方法可以在 Python 中执行终端模拟吗?
I'd like to have an xterm-compatible virtual terminal running inside a Python app.
I'll need to run ncurses-based applications inside it, feed it with user's input and read its output.
So far I've found python-vte, but it only provides a GTK+ widget (libvte has the required VtePty class, but Python bindings don't) and has an unacceptable libgtk dependency.
Is there any other way to perform a teminal emulation in Python?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
毕竟,我找到了 pyte,这正是我想要的。
After all, I've found the pyte, which is exactly what I wanted.
您是否看过这个 VT100 终端仿真器,也在博客形式中进行了描述这里?它不是 xterm 模拟器,但也许可以用于您的目的。
Have you looked at this VT100 terminal emulator, also described in blog form here? It's not an xterm emulator, but perhaps it can be leveraged for your purposes.
我一直在运行 Rails 教程 网站 &已部署 Gateone 终端模拟器供用户执行命令。后来我们开发了自己的终端仿真。检查 http://github.com/pocha/terminal-codelearn 。
如果您只需要以用户身份执行命令,那么您可能只需要 http://docs .python.org/2/library/pty.html
I have been running a Rails Tutorial site & have deployed Gateone terminal emulator for users to execute commands. Later we devloped our own Terminal emulation. Check http://github.com/pocha/terminal-codelearn .
If you just need to execute command as a user, then probably you just need http://docs.python.org/2/library/pty.html