Package: 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 positioningKeyboard input (without blocking or echoing) including unicode supportMouse input (terminal permitting)Detecting and handling when the console resizesScreen scrapingIn addition, it provides some simple, high-level APIs to provide more complex features including:Anti-aliased ASCII line-drawingImage to ASCII conversion - including JPEG and GIF formatsMany 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 ofhttps://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).InstallationAsciimatics supports Python version 3.  For the precise list of tested versions,
refer topypi.  The last version of asciimatics
to support Python 2 is v1.14.To install asciimatics, simply install withpipas follows:$pipinstallasciimaticsThis 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 inrequirements.txt.
Additionally, Windows users (who aren’t usingpip) will need to installpywin32.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”:fromrandomimportrandintfromasciimatics.screenimportScreendefdemo(screen):whileTrue: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()ifevin(ord('Q'),ord('q')):returnscreen.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:fromasciimatics.effectsimportCycle,Starsfromasciimatics.renderersimportFigletTextfromasciimatics.sceneimportScenefromasciimatics.screenimportScreendefdemo(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:Or maybe you’re looking to create a TUI?  In which case thissimple codewill give you this:DocumentationFull documentation of all the above (and more!) is available athttp://asciimatics.readthedocs.org/More examplesMore examples of what you can do are available in the project samples directory, hosted on GitHub.
Seehttps://github.com/peterbrittain/asciimatics/tree/v1.15/samples.To view them, simply download these files and then simply run them directly withpython.
Alternatively, you can browse recordings of many of the samples in the gallery athttps://github.com/peterbrittain/asciimatics/wiki.Bugs and enhancementsIf you have a problem, please check out the troubleshooting guide athttp://asciimatics.readthedocs.io/en/latest/troubleshooting.html.  If this doesn’t solve your
problem, you can report bugs (or submit enhancement requests) athttps://github.com/peterbrittain/asciimatics/issues.Alternatively, if you just have some questions, feel free to drop in athttps://gitter.im/asciimatics/Lobby.Contributing to the projectIf you’d like to take part in this project (and see your name in the credits!), check out the
guidance athttp://asciimatics.readthedocs.org/en/latest/contributing.html