File: demo07.py

package info (click to toggle)
python-colorama 0.4.6-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 448 kB
  • sloc: python: 1,428; sh: 49; makefile: 41
file content (27 lines) | stat: -rw-r--r-- 597 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from __future__ import print_function
import fixpath
import colorama

# Demonstrate cursor relative movement: UP, DOWN, FORWARD, and BACK in colorama.CURSOR

up = colorama.Cursor.UP
down = colorama.Cursor.DOWN
forward = colorama.Cursor.FORWARD
back = colorama.Cursor.BACK

def main():
    """
    expected output:
    1a2
    aba
    3a4
    """
    colorama.just_fix_windows_console()
    print("aaa")
    print("aaa")
    print("aaa")
    print(forward() + up(2) + "b" + up() + back(2) + "1" + forward() + "2" + back(3) + down(2) + "3" + forward() + "4")


if __name__ == '__main__':
    main()