Python ncurses、CDK、urwid 区别
这3个有什么区别?据我了解,它们都提供了对curses的绑定,curses是用于基于终端文本的UI的C库。
我目前对这三者一无所知,也从未使用过诅咒。您会推荐哪一款?我多次听说过 ncurses,但关于 CDK (通过研究)只听说过一两次,而且从未听说过 urwid (我认为)。
What's the difference between these 3? As far as I understand it they both provide binding to curses which is the C library for terminal text-based UI.
I currently have no knowledge of any of the 3 and I've never used curses. Which one would you recommend? I've heard of ncurses many times but only once or twice about CDK (through research) and never heard of urwid (I think).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看了一些参考资料后我得到的是:
curses
来说很难,但是对于urwid
来说很容易:在调整终端大小时重绘您的小部件并收集鼠标输入(单击按钮) , 例如)。因此,我的建议是使用 urwid,如果它不能满足您的需求,请寻找其他替代方案。
What I get after looking at some references is:
curses
, but are easy withurwid
are: redraw your widgets when the terminal is resized and gather mouse input (clicking on a button, for example).So my recommendation would be to use
urwid
and if it doesn't meet your needs look for other alternatives.我没有使用过任何库,但我假设您指的是:
curses
模块pycdk
,一个CDK 的 Python 接口urwid
控制台 UI 库它们只是具有相同目标的不同库:为基于控制台的 UI 提供 API。从上一个问题来看,似乎
curses
需要更多低级样板。需要注意的一件事是,Python 的 curses 模块仅在 Unix 下可用;如果您使用的是 Windows,您可能需要查看控制台
模块由 Fredrik Lundh 编写。其他两种选择似乎也很有前途,尽管
urwid
就开发而言看起来更有组织性,并且仍在积极开发中。I haven't used any of the libraries, but I'm assuming that you're referring to:
curses
modulepycdk
, a Python interface to CDKurwid
console UI libraryThey're just different libraries with the same goal: provide an API for a console-based UI. From a previous question, it seems that
curses
requires more low-level boilerplate. One thing to note is that Python'scurses
module is only available under Unix; if you're on Windows, you may want to look at theConsole
module written by Fredrik Lundh.Both of the other choices seem promising as well, although
urwid
looks to be more organized as far as development goes, and is still being actively developed somewhat.