Python ncurses, CDK, urwid difference

前端 未结 2 1409
臣服心动
臣服心动 2020-12-24 08:09

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

2条回答
  •  执笔经年
    2020-12-24 08:44

    What I get after looking at some references is:

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

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

提交回复
热议问题