
Ask HN: Recommendations for Good TUI Libraries (Text User Interface)? - andrewstuart
Anyone seen anything exciting&#x2F;interesting in the field of TUI&#x27;s?  Any language, as long as the library is interesting with good examples or screen shots&#x2F;videos.<p>For those unfamiliar, a TUI is a text mode user interface library, for building user interfaces within character oriented plain text consoles.
======
heldergg
Turbo Vision, this is TUI perfection.

[https://en.wikipedia.org/wiki/Turbo_Vision](https://en.wikipedia.org/wiki/Turbo_Vision)

~~~
magiblot
I recently added Unicode support into Turbo Vision:
[https://github.com/magiblot/tvision](https://github.com/magiblot/tvision)

~~~
neverartful
Wow! What an awesome and pleasant surprise! I have such fond memories of using
Borland IDEs from that era and some of the applications built with TV. Thank
you for making it modernized and available on Linux!

------
zephraph
In the node ecosystem there are a few interesting ones.

[https://github.com/vadimdemedes/ink](https://github.com/vadimdemedes/ink) for
writing TUIs with react. Here's a project I wrote using that:
[https://github.com/zephraph/solitaire](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](https://github.com/cronvel/terminal-
kit)

~~~
andrewstuart
[https://github.com/cronvel/terminal-kit](https://github.com/cronvel/terminal-
kit)

This is the one that most catches my attention.

Currently actively maintained plus it has something analagous to a document
object model [https://github.com/cronvel/terminal-
kit/blob/master/doc/docu...](https://github.com/cronvel/terminal-
kit/blob/master/doc/document-model.md#top)

Also Ink is incredibly interesting as it enables ReactJS for creating TUI apps
- mind bending!

[https://github.com/vadimdemedes/ink](https://github.com/vadimdemedes/ink)

I can imagine the things above being combined with a sandbox plus Fabrice
Bellard's QuickJS [https://bellard.org/quickjs/](https://bellard.org/quickjs/)
into a new type of application ..... the "pure text mode browser".

A "pure text mode browser" would not be designed to render ordinary HTML web
pages, but would instead be a minimal browser designed only for text mode.

~~~
beamatronic
So, lynx?
[https://en.wikipedia.org/wiki/Lynx_(web_browser)](https://en.wikipedia.org/wiki/Lynx_\(web_browser\))

~~~
andrewstuart
No, I meant a text mode browser that does not use HTML. Lynx, and all the
existing text mode browsers are intended to render HTML as text.

This would be a browser that targets only text mode user interfaces. So pages
would need to be written specifically to be rendered in such an environment.

Why? Because text mode browsers are really trying to do the impossible - to
render modern web pages as text is essentially not doable in all cases.
Instead make a browser for the text mode use case specifically designed for
the medium.

A mashup of a web browser and ANSI/VT100/teletext. It would need a sandbox and
a JavaScript interpreter.

Maybe call it the "Trowser".

~~~
beamatronic
Sounds like gopher?

[https://en.m.wikipedia.org/wiki/Gopher_(protocol)](https://en.m.wikipedia.org/wiki/Gopher_\(protocol\))

There was a sliver of time in the 1990s, in academic settings, where it was
very easy to get onto an Internet-connected Unix computer, but before HTML
existed. There were many plain text Internet applications.

------
andrewstuart
This looks pretty impressive:

Terminal.Gui - Terminal GUI toolkit for .NET

[https://github.com/migueldeicaza/gui.cs](https://github.com/migueldeicaza/gui.cs)

Written by Miguel de Icaza.

Hanselman wrote on it here:

[https://www.hanselman.com/blog/Its2020AndItIsTimeForTextMode...](https://www.hanselman.com/blog/Its2020AndItIsTimeForTextModeWithGuics.aspx)

and here:

[https://www.hanselman.com/blog/DotnetDependsIsAGreatTextMode...](https://www.hanselman.com/blog/DotnetDependsIsAGreatTextModeDevelopmentUtilityMadeWithGuics.aspx)

~~~
dsissitka
I’m curious about what other people think about this one. I tried the demo in
a few terminals a couple months ago and it didn’t work well in any of them.

~~~
algorithmsRcool
It is ok, but I would not recommend it. It got off to a great start but I ran
into problems/limitations with some fairly basic stuff.

I can't recall exactly what my issue was with it however, it has been a few
months.

------
sbeckeriv
[https://github.com/fdehau/tui-rs](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](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.

~~~
rbanffy
How popular is it in the Python space? I loved the large text widget and would
love to contribute with a font using the Teletext 2x3 mosaics that got into
Unicode 13 (which are fully supported in VTE)

~~~
njt
You can check out download stats stats for Urwid on PyPI Stats [1], that
should give you a decent idea of its popularity.

Also check out the list of applications built with Urwid [2]. Probably the two
most popular applications that use Urwid are bpython [3] (an alternative
Python REPL that is really nice), and PUDB [4] (a nice Python debugger that is
reminiscent of Borland's Turbo Pascal). I use bpython all the time, it's a
lifesaver, and I occasionally fire up PUDB when I am really stuck on
something.

I've used Urwid in a couple of projects (most notably Zeitzono [5]), it's nice
in that it's fairly high level and gives you a number of helpful widgets to
work with. Starting with it from scratch is a little daunting, so you should
look at existing projects to see how they are using the library. Also, I
believe Urwid development has slowed down somewhat in the last few years
(although other folks maybe stepping up to take over from the original author,
I haven't follow up on this in a while).

Also definitely take a look at Python Prompt Toolkit [6]. They started off as
library for writing line-oriented command interpreters, but now can also be
used for building full screen applications. I've not yet built an application
using it, but it looks really good and is actively developed. ptpython [7] is
a REPL built using this library and gives bpython a run for its money.

[1]
[https://pypistats.org/packages/urwid](https://pypistats.org/packages/urwid)

[2] [https://github.com/urwid/urwid/wiki/Application-
list](https://github.com/urwid/urwid/wiki/Application-list)

[3] [https://bpython-interpreter.org/](https://bpython-interpreter.org/)

[4] [https://github.com/inducer/pudb](https://github.com/inducer/pudb)

[5] [https://zeitzono.org/](https://zeitzono.org/)

[6] [https://github.com/prompt-toolkit/python-prompt-
toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit)

[7] [https://github.com/prompt-toolkit/ptpython](https://github.com/prompt-
toolkit/ptpython)

~~~
rbanffy
Thank you. I completely forgot about 1.

I realize, with abit of shame, urwid is thousands of times more popular than
my own pip-chill tool.

------
css
Python includes bindings for curses and includes some pretty good
documentation: [https://docs.python.org/3/howto/curses.html#curses-
howto](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.

~~~
andrewstuart
When I saw this message I was reminded of a post I read recently:

[http://xn--rpa.cc/irl/term.html](http://xn--rpa.cc/irl/term.html)

Here's how it starts:

"so here's a short tutorial on ansi escape codes and terminal control, because
you philistines won't stop using ncurses and oh my god WHY ARE WE STILL USING
NCURSES IT IS THE TWENTY FIRST FUCKING CENTURY"

------
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](https://github.com/dheera/python-termgraphics)

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

[https://github.com/dheera/rosshow](https://github.com/dheera/rosshow)

~~~
rbanffy
Teletext (also TRS-80) 2x3 mosaics got into Unicode 13. I hope Kaypro's 2x4
mosaics get into version 14.

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

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

------
lproven
Oberon. :-)

It's the granddaddy of all of them.

Overview:
[http://ignorethecode.net/blog/2009/04/22/oberon/](http://ignorethecode.net/blog/2009/04/22/oberon/)

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

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.

------
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](https://github.com/bmsauer/termbox-ada)

~~~
danudey
Looks like the project is no longer being maintained (as of two weeks ago?),
so it kind of pours water on that idea (unless you or someone else is going to
take over the main library maintainer work).

~~~
fuball63
There is someone that is picking up the work. They emailed me a few weeks ago
about how they are starting a new termbox org on Github, but I haven't checked
into its progress yet.

Either way, it is an extremely minimalistic library that has well documented
code, so it's very possible to tailor it to whatever needs you have.

------
aaron-santos
[https://github.com/chjj/blessed](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.

~~~
airstrike
Now that is a clever project name

~~~
vram22
Check out blessings -
[https://news.ycombinator.com/item?id=24423590](https://news.ycombinator.com/item?id=24423590)

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

Edit: found one
[https://github.com/vinibiavatti1/TuiCss](https://github.com/vinibiavatti1/TuiCss)

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

    
    
      #include <stdio.h>
      #include <termios.h>
      #include <unistd.h>
    

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

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

------
sjakobi
[http://hackage.haskell.org/package/brick](http://hackage.haskell.org/package/brick)
is popular in the Haskell world.

~~~
2mol
Can confirm that it's awesome for getting something small and useful done
quickly.

I was a beginner Haskell programmer when I first used brick, and it's great
exposure to building a real world application (something a lot of Haskell
beginners crave learning). Docs are very good too.

Code for anyone that might find it useful:
[https://github.com/2mol/pboy](https://github.com/2mol/pboy)

edit: forgot to mention that it's very "Elm architecture", so if you like
modern frontend development, then you might feel right at home in that
paradigm.

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

[https://ifcomp.org/comp/2019](https://ifcomp.org/comp/2019)

Two libraries for writing these games:

[https://en.wikipedia.org/wiki/Inform](https://en.wikipedia.org/wiki/Inform)

[https://en.wikipedia.org/wiki/TADS](https://en.wikipedia.org/wiki/TADS)

~~~
jart
If you want a Terminal Nintendo Emulator check out
[https://justine.storage.googleapis.com/nesemu1.html](https://justine.storage.googleapis.com/nesemu1.html)

------
kitd
TView is popular and active in the Golang world

[https://github.com/rivo/tview](https://github.com/rivo/tview)

~~~
makeworld
I prefer cview, it has added many fixes and PRs not in tview.

[https://gitlab.com/tslocum/cview](https://gitlab.com/tslocum/cview)

------
gw
For nim i like this one:
[https://github.com/johnnovak/illwill](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/](https://github.com/tj/commander.js/)

\- [ _chalk_ ] colors in the terminal ---
[https://github.com/chalk/chalk](https://github.com/chalk/chalk)

\- [ _figlet_ ] big splash text ---
[https://www.npmjs.com/package/figlet](https://www.npmjs.com/package/figlet)

------
nikisweeting
I like
[https://github.com/bpython/curtsies](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](https://github.com/prompt-toolkit/python-prompt-toolkit)

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

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

------
jakobdabo
notcurses -
[https://github.com/dankamongmen/notcurses](https://github.com/dankamongmen/notcurses)

------
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...](https://jugad2.blogspot.com/2012/08/blessings-curses-like-python-
library.html?m=0)

------
manjana
You could check out AsciiMatics.
[https://github.com/peterbrittain/asciimatics](https://github.com/peterbrittain/asciimatics)

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

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

[http://www.gnu.org/software/guile-
ncurses/](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](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/](http://urwid.org/)).

------
corysama
I'd to try out
[https://github.com/ggerganov/imtui](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/](https://aerc-mail.org/)

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

~~~
Shared404
It looks like Tcell probably, assuming I've understood what Tcell does
correctly.

[https://github.com/gdamore/tcell/](https://github.com/gdamore/tcell/)

