dirtywords

portable text interface framework  https://pypi.python.org/pypi/dirtywords
git clone https://git.ce9e.org/dirtywords.git

commit
2cf2ef261b91f9d03c7dcb38b9b571aba7f7d948
parent
fe387507cd3b60402b03fceea602f948a6648932
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2014-10-07 19:28
add example to README

Diffstat

M README.rst 19 +++++++++++++++++++

1 files changed, 19 insertions, 0 deletions


diff --git a/README.rst b/README.rst

@@ -15,6 +15,25 @@ There are currently three implementations of the core: One based on `curses`_,
   15    15 another one based on `pygame`_, and a minimal implementation without any
   16    16 dependencies outside of the standard library.
   17    17 
   -1    18 Example
   -1    19 -------
   -1    20 
   -1    21 ::
   -1    22 
   -1    23     import sys
   -1    24     from dirtywords import Screen, Window, AttrString
   -1    25 
   -1    26     text = AttrString(u'Hello World!', fg_color=(0, 255, 0))
   -1    27     screen = Screen(3, len(text) + 4)
   -1    28     screen.border()
   -1    29     screen.putstr(1, 2, text)
   -1    30     screen.refresh()
   -1    31 
   -1    32     while True:
   -1    33         ch = screen.getch()
   -1    34         if ch == ord('q'):
   -1    35             screen.cleanup()
   -1    36             sys.exit()
   18    37 
   19    38 .. _curses: https://docs.python.org/2/library/curses.html
   20    39 .. _pygame: http://pygame.org