Python ncurses,CDK,urwid差异 [英] Python ncurses, CDK, urwid difference

查看:115
本文介绍了Python ncurses,CDK,urwid差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这3个有什么区别?据我了解,它们都提供对curses的绑定,curses是基于文本的终端UI的C库.

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.

我目前不了解这3个中的任何一个,而且我从未使用过诅咒.您会推荐哪一个?我已经多次听说过ncurses,但关于CDK却只有一两次(通过研究),而从未听说过urwid(我认为).

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).

推荐答案

查看一些参考文献后得到的是:

What I get after looking at some references is:

  • ncurses :这是curses的免费软件版本,因此您必须处理所有此类问题低级详细信息.
  • pyCDK :这是一个高级库,提供了一些小部件.我还没有使用过它,但是根据sourceforge项目页面的介绍,它已经很久没有维护了(至少是python绑定),所以我不会再使用它了.
  • urwid :我已经使用过这个了,我不得不说它仍然有点低(它是一个框架而不是窗口小部件库),但仍然比curses有用,而且用户友好得多.作为UI框架,它具有您通常期望的所有内容,例如小部件,事件以及控制小部件布局的方法.我想说的一些事情对于curses来说很困难,但是对urwid来说却很容易:在调整终端大小时重新绘制窗口小部件,并收集鼠标输入(例如,单击按钮).
  • ncurses: It's a free software version of curses, so you have to deal with all kind low-level details.
  • pyCDK: It's a higher level library that provides some widgets. I haven't used this one, but according to the sourceforge project page it's been unmaintained for a long time (at least the python binding), so I wouldn't go with this one.
  • urwid: I've used this one and I've to say it's still a little bit low level (it's more a framework than a widget library), but still quite useful and much user-friendlier than curses. As a UI framework it has all the stuff you'd typically expect like widgets, events and a way to control the layout of the widgets. Some things that I'd say are hard with curses, but are easy with urwid are: redraw your widgets when the terminal is resized and gather mouse input (clicking on a button, for example).

所以我的建议是使用urwid,如果它不能满足您的需求,请寻找其他选择.

So my recommendation would be to use urwid and if it doesn't meet your needs look for other alternatives.

这篇关于Python ncurses,CDK,urwid差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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