diff options
-rw-r--r-- | README.rst | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -17,7 +17,7 @@ Coding with Blessings looks like this... print 'This is at the bottom.' Or, for byte-level control, you can drop down and play with raw terminal -capabilities +capabilities: .. code:: python @@ -48,7 +48,7 @@ Before And After ---------------- Without Blessings, this is how you'd print some underlined text at the bottom -of the screen +of the screen: .. code:: python @@ -80,7 +80,7 @@ of the screen print rc # Restore cursor position. That was long and full of incomprehensible trash! Let's try it again, this time -with Blessings +with Blessings: .. code:: python @@ -104,7 +104,7 @@ Simple Formatting ----------------- Lots of handy formatting codes ("capabilities" in low-level parlance) are -available as attributes on a ``Terminal``. For example +available as attributes on a ``Terminal``. For example... .. code:: python @@ -114,7 +114,7 @@ available as attributes on a ``Terminal``. For example print 'I am ' + term.bold + 'bold' + term.normal + '!' Though they are strings at heart, you can also use them as callable wrappers so -you don't have to say ``normal`` afterward +you don't have to say ``normal`` afterward: .. code:: python @@ -122,7 +122,7 @@ you don't have to say ``normal`` afterward Or, if you want fine-grained control while maintaining some semblance of brevity, you can combine it with Python's string formatting, which makes -attributes easy to access +attributes easy to access: .. code:: python @@ -164,7 +164,7 @@ Color ----- 16 colors, both foreground and background, are available as easy-to-remember -attributes +attributes: .. code:: python @@ -175,7 +175,7 @@ attributes print term.bright_red + term.on_bright_blue + 'This is even worse!' + term.normal You can also call them as wrappers, which sets everything back to normal at the -end +end: .. code:: python @@ -198,7 +198,7 @@ You can set the background color instead of the foreground by prepending for example, ``on_bright_blue``. There is also a numerical interface to colors, which takes an integer from -0-15 +0-15: .. code:: python @@ -220,7 +220,7 @@ Compound Formatting ------------------- If you want to do lots of crazy formatting all at once, you can just mash it -all together +all together: .. code:: python @@ -230,7 +230,7 @@ all together print term.bold_underline_green_on_yellow + 'Woo' + term.normal Or you can use your newly coined attribute as a wrapper, which implicitly sets -everything back to normal afterward +everything back to normal afterward: .. code:: python @@ -257,7 +257,7 @@ Moving Temporarily Most often, you'll need to flit to a certain location, print something, and then return: for example, when updating a progress bar at the bottom of the -screen. ``Terminal`` provides a context manager for doing this concisely +screen. ``Terminal`` provides a context manager for doing this concisely: .. code:: python @@ -278,7 +278,7 @@ just one of them, leaving the other alone. For example... If you're doing a series of ``move`` calls (see below) and want to return the cursor to its original position afterward, call ``location()`` with no -arguments, and it will do only the position restoring +arguments, and it will do only the position restoring: .. code:: python @@ -295,7 +295,7 @@ Moving Permanently ~~~~~~~~~~~~~~~~~~ If you just want to move and aren't worried about returning, do something like -this +this: .. code:: python @@ -344,7 +344,7 @@ For example... Height And Width ---------------- -It's simple to get the height and width of the terminal, in characters +It's simple to get the height and width of the terminal, in characters: .. code:: python @@ -390,7 +390,7 @@ state-restoration thing, use these capabilities: Using ``exit_fullscreen`` will wipe away any trace of your program's output, so reserve it for when you don't want to leave anything behind in the scrollback. -There's also a context manager you can use as a shortcut +There's also a context manager you can use as a shortcut: .. code:: python @@ -418,7 +418,7 @@ through ``less -r``, which handles terminal escapes just fine--pass In any case, there is a ``does_styling`` attribute on ``Terminal`` that lets you see whether your capabilities will return actual, working formatting codes. If it's false, you should refrain from drawing progress bars and other frippery -and just stick to content, since you're apparently headed into a pipe +and just stick to content, since you're apparently headed into a pipe: .. code:: python |