diff options
author | Erik Rose <erik@mozilla.com> | 2012-02-01 14:03:20 -0800 |
---|---|---|
committer | Erik Rose <erik@mozilla.com> | 2012-02-01 14:03:20 -0800 |
commit | 103f089a2081a83a1d0fc471c2aa484ce30da407 (patch) | |
tree | b5f1d8443cf8fec85095acf4d65c75bec2838953 /README.rst | |
parent | 4ab628f086ad697243159d4700a5e661297d748d (diff) | |
download | blessings-103f089a2081a83a1d0fc471c2aa484ce30da407.tar.gz |
Document an idiom for restoring the cursor location after a series of manual moves. Closes #17.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -70,8 +70,8 @@ of the screen:: normal=normal) print rc # Restore cursor position. -Phew! That was long and full of incomprehensible trash! Let's try it again, -this time with Blessings:: +That was long and full of incomprehensible trash! Let's try it again, this time +with Blessings:: from blessings import Terminal @@ -238,7 +238,9 @@ Here are some of interest: ``move`` Position the cursor elsewhere. Parameters are y coordinate, then x - coordinate. + coordinate:: + + print term.move(10, 1) + 'Hi, mom!' ``move_x`` Move the cursor to the given column. ``move_y`` @@ -283,7 +285,14 @@ just one of them, leaving the other alone. For example... :: with term.location(y=10): print 'We changed just the row.' -If you want to reposition permanently, see ``move``, in an example above. +If you want to reposition permanently, see ``move``, in an example above. If +you're doing a series of ``move`` calls and want to return the cursor to its +original position afterward, call ``location()`` with no arguments, and it will +do only the position restoring:: + + with term.location(): + print term.move(1, 1) + 'Hi' + print term.move(9, 9) + 'Mom' Pipe Savvy ---------- |