13 ms·
Ask HN: 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.
- dheera 6y agoI 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 6y agoTeletext (also TRS-80) 2x3 mosaics got into Unicode 13. I hope Kaypro's 2x4 mosaics get into version 14.
- andrewstuart 6y agoThis 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/Its2020AndItIsTimeForTextModeWithGuics.aspx https://www.hanselman.com/blog/Its2020AndItIsTimeForTextMode... and here: https://www.hanselman.com/blog/DotnetDependsIsAGreatTextModeDevelopmentUtilityMadeWithGuics.aspx https://www.hanselman.com/blog/DotnetDependsIsAGreatTextMode...
- dsissitka 6y agoI’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.
- Mister_Snuggles 6y agoI 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.
- algorithmsRcool 6y agoIt 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.
- algorithmsRcool 6y agoI 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/spectresystems/spectre.console https://github.com/TomaszRewak/C-sharp-console-gui-framework https://github.com/TomaszRewak/C-sharp-console-gui-framework https://github.com/elw00d/consoleframework https://github.com/elw00d/consoleframework
- aaron-santos 6y agohttps://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.
- imhoguy 6y agoDon'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
- allthing 6y agoI'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/).
- css 6y agoPython 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
- aeontech 6y agopython 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 6y agonotcurses - https://github.com/dankamongmen/notcurses https://github.com/dankamongmen/notcurses
- heldergg 6y agoTurbo Vision, this is TUI perfection. https://en.wikipedia.org/wiki/Turbo_Vision https://en.wikipedia.org/wiki/Turbo_Vision
- ystad 6y agoAh, I remember this. This is friendly UI
- heldergg 6y agoIndeed 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.
- magiblot 6y agoI recently added Unicode support into Turbo Vision: https://github.com/magiblot/tvision https://github.com/magiblot/tvision
- neverartful 6y agoWow! 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!
- sbeckeriv 6y agohttps://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.
- sjakobi 6y agohttp://hackage.haskell.org/package/brick http://hackage.haskell.org/package/brick is popular in the Haskell world.
- 2mol 6y agoCan 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.
- elviejo 6y agocame 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.
- xfer 6y agoThis doesn't support windows.
- jamesponddotco 6y agoaerc[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 6y agoIt looks like Tcell probably, assuming I've understood what Tcell does correctly. https://github.com/gdamore/tcell/ https://github.com/gdamore/tcell/
- kitd 6y agoTView is popular and active in the Golang world https://github.com/rivo/tview https://github.com/rivo/tview
- makeworld 6y agoI prefer cview, it has added many fixes and PRs not in tview. https://gitlab.com/tslocum/cview https://gitlab.com/tslocum/cview
- manjana 6y agoYou 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
- gw 6y agoFor 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.
- sixhobbits 6y agoAlso 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
- zephraph 6y agoIn 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 6y agohttps://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/document-model.md#top 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 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 6y agoSo, lynx? https://en.wikipedia.org/wiki/Lynx_(web_browser) https://en.wikipedia.org/wiki/Lynx_(web_browser)
- andrewstuart 6y agoNo, 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".
- andyv 6y agoMy 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 6y agoHow 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)
- andyv 6y agoSorry, I don't know how popular it is with respect to similar solutions.
- njt 6y agoYou 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
- tabtab 6y agoI'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.
- nikisweeting 6y agoI 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.
- corysama 6y agoI'd to try out https://github.com/ggerganov/imtui https://github.com/ggerganov/imtui Looks like a lot of fun.
- fuball63 6y agoI 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 6y agoLooks 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 6y agoThere 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.
- konjin 6y agoYou 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.
- sgillen 6y agoWas really surprised with all the JS etc options I had to scroll through to find ncurses, which to me is synonymous with TUIs!
- rozab 6y agoUsing 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
- andrewstuart 6y agoWhen 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"
- gitgud 6y agoFor 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
- kats 6y agoCheck 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
- peatmoss 6y agoI’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 6y agoI 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
- slmjkdbtl 6y agoFor 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.html https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode...
- vram22 6y agoI 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-python-library.html?m=0 https://jugad2.blogspot.com/2012/08/blessings-curses-like-py...
- lproven 6y agoOberon. :-) 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/ecdaf5c3d962e2778f804e8c64d292de408b.pdf 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.