1Metadata-Version: 2.1 2Name: curtsies 3Version: 0.3.10 4Summary: Curses-like terminal wrapper, with colored strings! 5Home-page: https://github.com/bpython/curtsies 6Author: Thomas Ballinger 7Author-email: thomasballinger@gmail.com 8License: MIT 9Platform: UNKNOWN 10Classifier: Development Status :: 3 - Alpha 11Classifier: Environment :: Console 12Classifier: Intended Audience :: Developers 13Classifier: License :: OSI Approved :: MIT License 14Classifier: Operating System :: POSIX 15Classifier: Programming Language :: Python 16Classifier: Programming Language :: Python :: 3 17Requires-Python: >=3.6 18Description-Content-Type: text/markdown 19License-File: LICENSE 20 21[![Documentation Status](https://readthedocs.org/projects/curtsies/badge/?version=latest)](https://readthedocs.org/projects/curtsies/?badge=latest) 22![Curtsies Logo](http://ballingt.com/assets/curtsiestitle.png) 23 24Curtsies is a Python 3.6+ compatible library for interacting with the terminal. 25This is what using (nearly every feature of) curtsies looks like: 26 27```python 28import random 29import sys 30 31from curtsies import FullscreenWindow, Input, FSArray 32from curtsies.fmtfuncs import red, bold, green, on_blue, yellow 33 34print(yellow('this prints normally, not to the alternate screen')) 35 36with FullscreenWindow() as window: 37 a = FSArray(window.height, window.width) 38 msg = red(on_blue(bold('Press escape to exit, space to clear.'))) 39 a[0:1, 0:msg.width] = [msg] 40 window.render_to_terminal(a) 41 with Input() as input_generator: 42 for c in input_generator: 43 if c == '<ESC>': 44 break 45 elif c == '<SPACE>': 46 a = FSArray(window.height, window.width) 47 else: 48 s = repr(c) 49 row = random.choice(range(window.height)) 50 column = random.choice(range(window.width-len(s))) 51 color = random.choice([red, green, on_blue, yellow]) 52 a[row, column:column+len(s)] = [color(s)] 53 window.render_to_terminal(a) 54``` 55 56Paste it in a `something.py` file and try it out! 57 58Installation: `pip install curtsies` 59 60[Documentation](http://curtsies.readthedocs.org/en/latest/) 61 62Primer 63------ 64 65[FmtStr](http://curtsies.readthedocs.org/en/latest/FmtStr.html) objects are strings formatted with 66colors and styles displayable in a terminal with [ANSI escape sequences](http://en.wikipedia.org/wiki/ANSI_escape_code>`_). 67 68![](https://i.imgur.com/bRLI134.png) 69 70[FSArray](http://curtsies.readthedocs.org/en/latest/FSArray.html) objects contain multiple such strings 71with each formatted string on its own row, and FSArray 72objects can be superimposed on each other 73to build complex grids of colored and styled characters through composition. 74 75(the import statement shown below is outdated) 76 77![](http://i.imgur.com/rvTRPv1.png) 78 79Such grids of characters can be rendered to the terminal in alternate screen mode 80(no history, like `Vim`, `top` etc.) by [FullscreenWindow](http://curtsies.readthedocs.org/en/latest/window.html#curtsies.window.FullscreenWindow) objects 81or normal history-preserving screen by [CursorAwareWindow](http://curtsies.readthedocs.org/en/latest/window.html#curtsies.window.CursorAwareWindow) objects. 82User keyboard input events like pressing the up arrow key are detected by an 83[Input](http://curtsies.readthedocs.org/en/latest/input.html) object. 84 85Examples 86-------- 87 88* [Tic-Tac-Toe](/examples/tictactoeexample.py) 89 90![](http://i.imgur.com/AucB55B.png) 91 92* [Avoid the X's game](/examples/gameexample.py) 93 94![](http://i.imgur.com/nv1RQd3.png) 95 96* [Bpython-curtsies uses curtsies](http://ballingt.com/2013/12/21/bpython-curtsies.html) 97 98[![](http://i.imgur.com/r7rZiBS.png)](http://www.youtube.com/watch?v=lwbpC4IJlyA) 99 100* [More examples](/examples) 101 102About 103----- 104 105* [Curtsies Documentation](http://curtsies.readthedocs.org/en/latest/) 106* Curtsies was written to for [bpython-curtsies](http://ballingt.com/2013/12/21/bpython-curtsies.html) 107* `#bpython` on irc is a good place to talk about Curtsies, but feel free 108 to open an issue if you're having a problem! 109* Thanks to the many contributors! 110* If all you need are colored strings, consider one of these [other 111 libraries](http://curtsies.readthedocs.io/en/latest/FmtStr.html#fmtstr-rationale)! 112 113 114