ansi_escape/doc/cursor.md

49 lines
1.2 KiB
Markdown

Cursor control
==============
Move to spesific coordinates
----------------------------
To move the terminal cursor using positional coordinates use the following function:
```python
ansi_escape.cursor_position()
```
If the function name is to long you can use:
```python
ansi_escape.cup()
```
instead.
```python
ansi_escape.cup() #sets position to 1,1
ansi_escape.cursor_position(row=5) #sets cursor position to row 5 and column 1
ansi_escape.cup(column=16) #sets cursor position to column 16 and row 1
ansi_escape.cursor_position(row=30, column=3) #sets cursor position to row 30 and column 3
```
Move cursor from current position
---------------------------------
For relative movements use:
```python
ansi_escape(direction, cells)
```
direction can be:
- "up"
- "down"
- "forward"
- "backward"
It is the direction the cursor moves towards.
cells is an optional argumant which specifies how many character cells you want to move the cursor.
Move cursor to spesific horisontal position
-------------------------------------------
Use:
```python
ansi_escape.cursor_horisontal_absolute(column)
#or
ansi_escape.cha(column)
```
column can be omitted and will then default to 1.
This will not affect the vertical coordinates of the cursor.