All Projects → pfalcon → Picotui

pfalcon / Picotui

Licence: mit
Lightweight, pure-Python Text User Interface (TUI) widget toolkit with minimal dependencies. Dedicated to the Pycopy project.

Programming Languages

python
139335 projects - #7 most used programming language
micropython
64 projects

Projects that are alternatives of or similar to Picotui

Tuicss
Text-based user interface CSS library
Stars: ✭ 167 (-69.47%)
Mutual labels:  terminal, tui, curses
Termox
C++17 Terminal User Interface(TUI) Library.
Stars: ✭ 306 (-44.06%)
Mutual labels:  terminal, tui, curses
Castero
TUI podcast client for the terminal
Stars: ✭ 375 (-31.44%)
Mutual labels:  terminal, tui, curses
Brick
A declarative Unix terminal UI programming library written in Haskell
Stars: ✭ 1,070 (+95.61%)
Mutual labels:  terminal, tui, curses
Pulsemixer
CLI and curses mixer for PulseAudio
Stars: ✭ 441 (-19.38%)
Mutual labels:  terminal, tui, curses
Zui
⬢ Zsh User Interface library – CGI+DHTML-like rapid application development with Zsh
Stars: ✭ 95 (-82.63%)
Mutual labels:  terminal, tui, curses
Ltui
🍖 A cross-platform terminal ui library based on Lua
Stars: ✭ 624 (+14.08%)
Mutual labels:  terminal, tui, curses
Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (-82.08%)
Mutual labels:  terminal, tui, curses
Rtv
Browse Reddit from your terminal
Stars: ✭ 4,558 (+733.27%)
Mutual labels:  terminal, tui, curses
Ticker
Terminal stock ticker with live updates and position tracking
Stars: ✭ 3,986 (+628.7%)
Mutual labels:  terminal, tui
Sad
CLI search and replace | Space Age seD
Stars: ✭ 350 (-36.01%)
Mutual labels:  terminal, tui
Pick
create curses based interactive selection list in the terminal
Stars: ✭ 370 (-32.36%)
Mutual labels:  terminal, curses
Tui Rs
Build terminal user interfaces and dashboards using Rust
Stars: ✭ 6,081 (+1011.7%)
Mutual labels:  terminal, tui
Gitui
Blazing 💥 fast terminal-ui for git written in rust 🦀
Stars: ✭ 6,762 (+1136.2%)
Mutual labels:  terminal, tui
Stig
TUI and CLI for the BitTorrent client Transmission
Stars: ✭ 360 (-34.19%)
Mutual labels:  terminal, tui
Peaclock
A responsive and customizable clock, timer, and stopwatch for the terminal.
Stars: ✭ 314 (-42.6%)
Mutual labels:  terminal, tui
Py cui
A python library for intuitively creating CUI/TUI interfaces with widgets, inspired by gocui.
Stars: ✭ 380 (-30.53%)
Mutual labels:  terminal, tui
Ratatouille
A TUI (terminal UI) kit for Elixir
Stars: ✭ 373 (-31.81%)
Mutual labels:  terminal, tui
Amfora
A fancy terminal browser for the Gemini protocol.
Stars: ✭ 395 (-27.79%)
Mutual labels:  terminal, tui
Xi Term
A terminal frontend for Xi
Stars: ✭ 446 (-18.46%)
Mutual labels:  terminal, tui

picotui

Picotui is a Text User Interface (TUI) widget library for Python3. It is known to work with CPython3 and Pycopy <https://github.com/pfalcon/pycopy>_ (Unix version is officially supported for the latter), but should work with any Python3 implementation which allows to access stdin/stdout file descriptors.

You can learn more about it with the help of a virtual Q&A session:

Q: There're a few TUI libraries for Python, why yet another one?

A: Urwid is one well-known such TUI library. Here's an entry from its FAQ: "How do I create drop-downs, floating windows, and scroll bars? - You need to start writing some fairly complex widgets. This functionality hasn't been added to Urwid yet." So, Urwid is a widget library which doesn't have dropdowns. Version 0.8.0 of Urwid was imported into SVN (and later Git) in 2004. Urwid doesn't have dropdowns and stuff for 10+ years.

Q: Hey, but you cut off the answer from Urwid FAQ. It says: "but if you are willing to write it, we do accept patches". Why didn't you implement those widgets for Urwid and contribute them?

A: Why didn't you? No, wait, that's not productive. I didn't implement them for Urwid because I don't like its architecture and the fact that its widget set is rather weak (so it's hard to write new widgets - there are not enough examples to start from). And don't get me wrong, but the fact that nobody wrote those widgets for Urwid during 10+ years, got to mean something. However, I tried to hack on another, less, but still known Python TUI library - Npyscreen. Its widget set is much more advanced and usable. But - it still has some architectural choices which makes extending it and overriding some behaviors problematic. I also found its project management a bit unresponsive. So, after making a dozen of commits to my fork, I thought it's time to get some breath and started picotui.

Q: So, sun must shine bright in the picotui land, and it must be the best library out there?

A: Alas, no. Let me start with the fact that most TUI libraries are based on curses library for terminal screen management. It makes sure that if you update a screen, only the minimal set of updates is made. This was very important at the era of 300 baud serial connections. Let's count: 300 baud is about 30 bytes/s, and the standard VT100 screen is 80*24 = ~2K. Double that for attributes. So, transferring a complete screen to show to user would take 2 mins. If you draw the same screen twice (no changes in content), it would take 4 mins. curses library cuts that back to mere 2 mins. So, alas, picotui doesn't use curses. That's based on the fact that picotui wants to be compatible with Pycopy, and its philosophy is minimalism - if it's possible to do screen output without curses, let's do just that. It's also grounded in the fact that nobody uses 300 baud modems any longer, most apps are run in a local terminal emulator with instant updates, most of the remaining are run over LANs which also offer fast updates. The modern basic serial connection speed is 115200 which is still too slow for real-time fullscreen updates though. That's why I say "alas". Beyond the optimized screen updates, picotui lacks many other things too: e.g., double-buffering (so redrawing the previous screen content behind pop-ups is up to you), it lacks geometry managers, so calculating coordinates is up to you, etc. Yes, just like that - I lacked widgets the most, and that's what I implemented. The rest is just KISS.

Q: But that's really sad!

A: Indeed, it is. The only good news is that now you have a choice: if you want your app work well with 300 baud modems, you can use other libraries, and if you want widgets, you can use picotui.

Q: So many words, where's a mandatory screenshot?

A: Sure:

.. image:: https://raw.githubusercontent.com/pfalcon/picotui/master/picotui.png

Documentation

Picotui is an experimental WIP project, and the best documentation currently is the source code (https://github.com/pfalcon/picotui/tree/master/picotui) and examples (see below).

Examples

  • example_widgets.py - Shows repertoire of widgets, inside a dialog.
  • example_menu.py - Shows a "fullscreen" application with a main menu.
  • example_dialogs.py - Shows some standard dialogs.
  • examples/ - More assorted examples.

Known Issues

Pay attention to what Unicode font you use in your console. Some Linux distributions, e.g. Ubuntu, are known to have a broken Unicode font installed by default, which causes various visual artifacts (specifically, Ubuntu Mono font isn't really monospace - many Unicode pseudographic characters have double (or so) width, box-drawing symbols have gaps, etc.)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].