- 280comments
- 78comments
- 92comments
- 170comments
- 19comments
- 33comments
- 300comments
- 441comments
- 15comments
- 110comments
- 263comments
- 3comments
- 384comments
- 16comments
- 26comments
- 30comments
- 523comments
- 1comments
- 14comments
- 8comments
- 38comments
- 15comments
- 9comments
- 38comments
- 19comments
- —discuss
- 102comments
- 2comments
- 119comments
- 161comments
For those unfamiliar, a TUI is a text mode user interface library, for building user interfaces within character oriented plain text consoles.
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
Teletext (also TRS-80) 2x3 mosaics got into Unicode 13. I hope Kaypro's 2x4 mosaics get into version 14.
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...
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.
I used this for a couple of toy programs when I worked through last year's Advent of Code. I found that it worked well and enjoyed using it, but again these were for toy programs.
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.
I tried to use Gui.cs and wasn't able to. It has a lot of rough edges and I had to move on because it wasn't well fleshed out.
Other/better .NET libraries include:
https://github.com/spectresystems/spectre.console
https://github.com/TomaszRewak/C-sharp-console-gui-framework
https://github.com/elw00d/consoleframework
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.
Now that is a clever project name
Check out blessings - https://news.ycombinator.com/item?id=24423590
Don't know why, but I have imagined a CSS framework for text only.
Edit: found one https://github.com/vinibiavatti1/TuiCss
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/).
Python includes bindings for curses and includes some pretty good documentation: https://docs.python.org/3/howto/curses.html#curses-howto
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/
notcurses - https://github.com/dankamongmen/notcurses
Turbo Vision, this is TUI perfection.
https://en.wikipedia.org/wiki/Turbo_Vision
Ah, I remember this. This is friendly UI
Indeed it was! This library produced easily discoverable UIs, it worked just as well with the keyboard or the mouse. The default layout was very pleasant.
From the developer's perspective, it was a joy to work with. I made some projects using pascal and C++ if I remember correctly.
I recently added Unicode support into Turbo Vision: https://github.com/magiblot/tvision
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!
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.
http://hackage.haskell.org/package/brick is popular in the Haskell world.
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
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.
came to mention Brick too. The advantage is that it follows the unidirectional data flow pattern. Aka the Elm architecture. the advantage is that the whole interface is drawn from the data. (or the view is generated only from the model). This simplifies development a lot.
This doesn't support windows.
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
It looks like Tcell probably, assuming I've understood what Tcell does correctly.
https://github.com/gdamore/tcell/
TView is popular and active in the Golang world
https://github.com/rivo/tview
I prefer cview, it has added many fixes and PRs not in tview.
https://gitlab.com/tslocum/cview
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
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.
Also take a look at Repl.it's "CLUI"[0] which they released fairly recently
[0] https://blog.repl.it/clui
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
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.
So, lynx? https://en.wikipedia.org/wiki/Lynx_(web_browser)
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".
I do not really understand the need/want/wish for something like this. There is no real textmode on contemporary hardware anymore. That is all emulated to get the legacy during startup going, until some graphical environment takes over. Keyword is framebuffer here.
Sounds like gopher?
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.
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.
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)
Sorry, I don't know how popular it is with respect to similar solutions.
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
[2] https://github.com/urwid/urwid/wiki/Application-list
[3] https://bpython-interpreter.org/
[4] https://github.com/inducer/pudb
[5] https://zeitzono.org/
[6] https://github.com/prompt-toolkit/python-prompt-toolkit
[7] https://github.com/prompt-toolkit/ptpython
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.
Seconding this, it’s what I used for my https://github.com/wtheisen/TerminusBrowser project and while it is a little weird the number of features and modes you can get out of it are fantastic
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.
I like https://github.com/bpython/curtsies by @ballingt. It was used to implement bpython, one of the best python REPLs imo.
I'd to try out https://github.com/ggerganov/imtui Looks like a lot of fun.
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
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).
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.
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.
Was really surprised with all the JS etc options I had to scroll through to find ncurses, which to me is synonymous with TUIs!
Using a higher-level wrapper is going to be way more portable since they handle all the gotchas. And also, ncurses is just highly unpleasant to use directy
When I saw this message I was reminded of a post I read recently:
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"
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
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
Good for Anchorhead, but not for something outside the Z Machine ;)
If you want a Terminal Nintendo Emulator check out https://justine.storage.googleapis.com/nesemu1.html
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.
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
For anyone who want to do it without a library it's actually really easy to get started with
and follow the beginning chapters of the great "Build Your Own Text Editor" tutorial[0].
[0] https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode...
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...
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.