Ask HN: Recommendations for Good TUI Libraries (Text User Interface)?
For those unfamiliar, a TUI is a text mode user interface library, for building user interfaces within character oriented plain text consoles.
For those unfamiliar, a TUI is a text mode user interface library, for building user interfaces within character oriented plain text consoles.
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
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...
Also Ink is incredibly interesting as it enables ReactJS for creating TUI apps - mind bending!
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/ 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.
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".
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.
From the developer's perspective, it was a joy to work with. I made some projects using pascal and C++ if I remember correctly.
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...
I can't recall exactly what my issue was with it however, it has been a few months.
Other/better .NET libraries include:
https://github.com/spectresystems/spectre.console
https://github.com/TomaszRewak/C-sharp-console-gui-framework
Liked using this. I wrote a TUI for my company's api with it. I dont use the website much any more.
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
[2] https://github.com/urwid/urwid/wiki/Application-list
[3] https://bpython-interpreter.org/
[4] https://github.com/inducer/pudb
I realize, with abit of shame, urwid is thousands of times more popular than my own pip-chill tool.
The terminal is not meant to be existing. You are emulating 80 year old technology at the base of it.
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"
https://github.com/dheera/python-termgraphics
I used it in ROSshow, which visualizes robot sensor data inside a terminal:
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.
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.
Edit: found one https://github.com/vinibiavatti1/TuiCss
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
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.
#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...
Two libraries for writing these games:
Here are some examples how it can look in action: https://github.com/peterbrittain/asciimatics/wiki
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.
- [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
[0]: https://github.com/prompt-toolkit/python-prompt-toolkit
Blessings, curses-like Python library:
https://jugad2.blogspot.com/2012/08/blessings-curses-like-py...
http://www.gnu.org/software/guile-ncurses/
The documentation always inspired confidence. Sadly haven’t written anything more than hello world.