HACKER Q&A
📣 andrewstuart

Recommendations for Good TUI Libraries (Text User Interface)?


Anyone seen anything exciting/interesting in the field of TUI's? Any language, as long as the library is interesting with good examples or screen shots/videos.

For those unfamiliar, a TUI is a text mode user interface library, for building user interfaces within character oriented plain text consoles.


  👤 zephraph Accepted Answer ✓
In the node ecosystem there are a few interesting ones.

https://github.com/vadimdemedes/ink for writing TUIs with react. Here's a project I wrote using that: https://github.com/zephraph/solitaire. It's not as powerful as ncurses, but it works rather well.

If you want something more on par with ncurses try https://github.com/cronvel/terminal-kit


👤 heldergg
Turbo Vision, this is TUI perfection.

https://en.wikipedia.org/wiki/Turbo_Vision


👤 andrewstuart
This looks pretty impressive:

Terminal.Gui - Terminal GUI toolkit for .NET

https://github.com/migueldeicaza/gui.cs

Written by Miguel de Icaza.

Hanselman wrote on it here:

https://www.hanselman.com/blog/Its2020AndItIsTimeForTextMode...

and here:

https://www.hanselman.com/blog/DotnetDependsIsAGreatTextMode...


👤 sbeckeriv
https://github.com/fdehau/tui-rs

Liked using this. I wrote a TUI for my company's api with it. I dont use the website much any more.


👤 andyv
My favorite is the python-based Urwid library at http://www.urwid.org. It was a little hard for me to wrap my head around it at first, but once you get it, you can write TUI applications without a lot of code. Easy to install, many examples to work from.

👤 css
Python includes bindings for curses and includes some pretty good documentation: https://docs.python.org/3/howto/curses.html#curses-howto

👤 konjin
You can't go wrong with Ncurses. Ancient, bindings to literally every language, stable and works everywhere including the kitchen sink.

The terminal is not meant to be existing. You are emulating 80 year old technology at the base of it.


👤 dheera
I wrote a Python library to draw graphics in a console using Braille dots, with a fallback mode to ASCII:

https://github.com/dheera/python-termgraphics

I used it in ROSshow, which visualizes robot sensor data inside a terminal:

https://github.com/dheera/rosshow


👤 sixhobbits
Also take a look at Repl.it's "CLUI"[0] which they released fairly recently

[0] https://blog.repl.it/clui


👤 fuball63
I like termbox. I'm the Ada binding maintainer. A quick search and you can find many other language bindings. https://github.com/bmsauer/termbox-ada

👤 lproven
Oberon. :-)

It's the granddaddy of all of them.

Overview: http://ignorethecode.net/blog/2009/04/22/oberon/

Academic paper (but highly accessible): https://pdfs.semanticscholar.org/d48b/ecdaf5c3d962e2778f804e...

Yes, it's an OS as well as a language although a tiny one that runs under MacOS, Linux and Windows if you want. So does the bare language of the same name. (Think of it as Pascal 3.)

The inspiration behind Plan 9's Acme.


👤 aaron-santos
https://github.com/chjj/blessed is a curses-like library with a high level terminal interface API for node.js. It also has impressive demos.

👤 imhoguy
Don't know why, but I have imagined a CSS framework for text only.

Edit: found one https://github.com/vinibiavatti1/TuiCss


👤 sjakobi
http://hackage.haskell.org/package/brick is popular in the Haskell world.

👤 slmjkdbtl
For anyone who want to do it without a library it's actually really easy to get started with

  #include 
  #include 
  #include 
and follow the beginning chapters of the great "Build Your Own Text Editor" tutorial[0].

[0] https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode...


👤 kats
Check out the Interactive Fiction competition, it's text-based video games.

https://ifcomp.org/comp/2019

Two libraries for writing these games:

https://en.wikipedia.org/wiki/Inform

https://en.wikipedia.org/wiki/TADS


👤 kitd
TView is popular and active in the Golang world

https://github.com/rivo/tview


👤 manjana
You could check out AsciiMatics. https://github.com/peterbrittain/asciimatics

Here are some examples how it can look in action: https://github.com/peterbrittain/asciimatics/wiki


👤 gw
For nim i like this one: https://github.com/johnnovak/illwill

It is immediate mode so you render the entire UI every tick, though it is smart enough to not actually redraw things that didn't change.


👤 gitgud
For small CLI tools, I find the following nodejs packages pretty helpful:

- [commanderjs] lets you easily build ergonomic CLI apps (wires up --help and usage descriptions) --- https://github.com/tj/commander.js/

- [chalk] colors in the terminal --- https://github.com/chalk/chalk

- [figlet] big splash text --- https://www.npmjs.com/package/figlet


👤 nikisweeting
I like https://github.com/bpython/curtsies by @ballingt. It was used to implement bpython, one of the best python REPLs imo.

👤 aeontech
python prompt toolkit [0] and click [1] are used to create tools like pgcli [2], which is utterly wonderful.

[0]: https://github.com/prompt-toolkit/python-prompt-toolkit

[1]: https://click.palletsprojects.com/en/7.x/

[2]: https://www.pgcli.com/


👤 jakobdabo

👤 tabtab
I've been looking for something similar that either has a markup language associated with it or is easy to add one to. I wish to prototype a GUI markup standard with it as a proof of concept so that we can have GUI-over-HTTP instead of live with the ever failing & bloated HTML/JS/DOM/CSS GUI emulators. So far, Terminal.Gui looks interesting, but I don't know if it's cross-platform yet.

👤 vram22
I blogged about blessings here, also briefly comparing one of its capabilities - saving and restoring terminal state - to that of C's curses:

Blessings, curses-like Python library:

https://jugad2.blogspot.com/2012/08/blessings-curses-like-py...


👤 peatmoss
I’ve often thought I’d like to spend some days writing ncurses interfaces in Guile.

http://www.gnu.org/software/guile-ncurses/

The documentation always inspired confidence. Sadly haven’t written anything more than hello world.


👤 Riverheart
I haven't used it but since it hasn't been mentioned, I recalled that Visidata's rendering library vdtui.py could be used for these tasks. They say so in their readme

https://github.com/saulpw/visidata


👤 allthing
I'm not really sure any TUI I've ever seen could really be classified as "good" but the one I like best is probably urwid (http://urwid.org/).

👤 corysama
I'd to try out https://github.com/ggerganov/imtui Looks like a lot of fun.

👤 jamesponddotco
aerc[1]'s design is the main reason why I use it over mutt, even though mutt has more features. No idea what they use behind the scenes for their TUI, but you could take a look at their source code[2].

[1] https://aerc-mail.org/

[2] https://git.sr.ht/~sircmpwn/aerc