All Projects → peterbrittain → Asciimatics

peterbrittain / Asciimatics

Licence: apache-2.0
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Asciimatics

Zui
⬢ Zsh User Interface library – CGI+DHTML-like rapid application development with Zsh
Stars: ✭ 95 (-96.69%)
Mutual labels:  console, tui, curses
Mitype
Typing speed test in terminal
Stars: ✭ 241 (-91.6%)
Mutual labels:  console, curses, cross-platform
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (-89.68%)
Mutual labels:  console, cross-platform, ascii-art
Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (-96.58%)
Mutual labels:  console, tui, curses
croatoan
Common Lisp bindings for the ncurses terminal library.
Stars: ✭ 111 (-96.13%)
Mutual labels:  console, tui, curses
Pulsemixer
CLI and curses mixer for PulseAudio
Stars: ✭ 441 (-84.63%)
Mutual labels:  console, tui, curses
Crossterm
Cross platform terminal library rust
Stars: ✭ 1,023 (-64.34%)
Mutual labels:  console, tui, cross-platform
Vifm
Vifm is a file manager with curses interface, which provides Vim-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Stars: ✭ 1,822 (-36.49%)
Mutual labels:  curses, cross-platform
Clrcli
CLRCLI is an event-driven library for building line-art user interfaces in C#/.Net command-line applications.
Stars: ✭ 124 (-95.68%)
Mutual labels:  console, tui
Nnn
n³ The unorthodox terminal file manager
Stars: ✭ 13,138 (+357.93%)
Mutual labels:  console, tui
Lazyhub
lazyhub - Terminal UI Client for GitHub using gocui.
Stars: ✭ 133 (-95.36%)
Mutual labels:  console, tui
Kubebox
⎈❏ Terminal and Web console for Kubernetes
Stars: ✭ 1,855 (-35.34%)
Mutual labels:  console, tui
Bottom
Yet another cross-platform graphical process/system monitor.
Stars: ✭ 3,182 (+10.91%)
Mutual labels:  tui, cross-platform
Phetch
🐭 quick lil gopher client for your terminal
Stars: ✭ 108 (-96.24%)
Mutual labels:  console, tui
Tty Pie
Draw pie charts in your terminal window
Stars: ✭ 125 (-95.64%)
Mutual labels:  console, ascii-art
Catsay
A program that generates pictures of a cat holding a sign with a message.
Stars: ✭ 85 (-97.04%)
Mutual labels:  cross-platform, ascii-art
Mandown
man-page inspired Markdown viewer
Stars: ✭ 173 (-93.97%)
Mutual labels:  console, tui
Tuicss
Text-based user interface CSS library
Stars: ✭ 167 (-94.18%)
Mutual labels:  tui, curses
Ascii
👾 ASCII Roulette :: ascii art video chat on the cli
Stars: ✭ 202 (-92.96%)
Mutual labels:  console, ascii-art
Jquery.terminal
jQuery Terminal Emulator - JavaScript library for creating web-based terminals with custom commands
Stars: ✭ 2,623 (-8.57%)
Mutual labels:  console, tui
Linux build status Code Health Code Coverage Latest stable version Join the chat at https://gitter.im/asciimatics/Lobby

ASCIIMATICS

Asciimatics is a package to help people create full-screen text UIs (from interactive forms to ASCII animations) on any platform. It is licensed under the Apache Software Foundation License 2.0.

Why?

Why not? It brings a little joy to anyone who was programming in the 80s... Oh and it provides a single cross-platform Python class to do all the low-level console function you could ask for, including:

  • Coloured/styled text - including 256 colour terminals and unicode characters (even CJK languages)
  • Cursor positioning
  • Keyboard input (without blocking or echoing) including unicode support
  • Mouse input (terminal permitting)
  • Detecting and handling when the console resizes
  • Screen scraping

In addition, it provides some simple, high-level APIs to provide more complex features including:

  • Anti-aliased ASCII line-drawing
  • Image to ASCII conversion - including JPEG and GIF formats
  • Many animation effects - e.g. sprites, particle systems, banners, etc.
  • Various widgets for text UIs - e.g. buttons, text boxes, radio buttons, etc.

Currently this package has been proven to work on CentOS 6 & 7, Raspbian (i.e. Debian wheezy), Ubuntu 14.04, Windows 7, 8 & 10, OSX 10.11 and Android Marshmallow (courtesy of https://termux.com), though it should also work for any other platform that provides a working curses implementation.

It should be implementation agnostic and has been successfully tested on CPython and PyPy2.

(Please let me know if you successfully verified it on other platforms so that I can update this list).

Installation

Asciimatics supports Python versions 2 & 3. For the precise list of tested versions, refer to pypi.

To install asciimatics, simply install with pip as follows:

$ pip install asciimatics

This should install all your dependencies for you. If you don't use pip or it fails to install them, you can install the dependencies directly using the packages listed in requirements.txt. Additionally, Windows users (who aren't using pip) will need to install pywin32.

How to use it?

To use the low-level API, simply create a Screen and use it to print coloured text at any location, or get mouse/keyboard input. For example, here is a variant on the classic "hello world":

from random import randint
from asciimatics.screen import Screen

def demo(screen):
    while True:
        screen.print_at('Hello world!',
                        randint(0, screen.width), randint(0, screen.height),
                        colour=randint(0, screen.colours - 1),
                        bg=randint(0, screen.colours - 1))
        ev = screen.get_key()
        if ev in (ord('Q'), ord('q')):
            return
        screen.refresh()

Screen.wrapper(demo)

That same code works on Windows, OSX and Linux and paves the way for all the higher level features. These still need the Screen, but now you also create a Scene using some Effects and then get the Screen to play it. For example, this code:

from asciimatics.effects import Cycle, Stars
from asciimatics.renderers import FigletText
from asciimatics.scene import Scene
from asciimatics.screen import Screen

def demo(screen):
    effects = [
        Cycle(
            screen,
            FigletText("ASCIIMATICS", font='big'),
            int(screen.height / 2 - 8)),
        Cycle(
            screen,
            FigletText("ROCKS!", font='big'),
            int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 500)])

Screen.wrapper(demo)

should produce something like this:

asciicast

Or maybe you're looking to create a TUI? In which case this simple code will give you this:

contact list sample

Documentation

Full documentation of all the above (and more!) is available at http://asciimatics.readthedocs.org/

More examples

More examples of what you can do are available in the project samples directory, hosted on GitHub. See https://github.com/peterbrittain/asciimatics/tree/v1.13/samples.

To view them, simply download these files and then simply run them directly with python. Alternatively, you can browse recordings of many of the samples in the gallery at https://github.com/peterbrittain/asciimatics/wiki.

Bugs and enhancements

If you have a problem, please check out the troubleshooting guide at http://asciimatics.readthedocs.io/en/latest/troubleshooting.html. If this doesn't solve your problem, you can report bugs (or submit enhancement requests) at https://github.com/peterbrittain/asciimatics/issues.

Alternatively, if you just have some questions, feel free to drop in at https://gitter.im/asciimatics/Lobby.

Contributing to the project

If you'd like to take part in this project (and see your name in the credits!), check out the guidance at http://asciimatics.readthedocs.org/en/latest/contributing.html

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].