palpatine package¶
Submodules¶
palpatine.const module¶
This module defines several constants to use with functions that require options to use.
- palpatine.const.AFTER = 0¶
Used with clear functions.
If supplied, the clear function will clear everything after the cursor.
Seealso: screen.clear(), line.clear()
- palpatine.const.ALL = 2¶
Used with clear functions.
If supplied, the clear function will clear the entire context (e.g. either the current line, or the whole screen).
Seealso: screen.clear(), line.clear()
- palpatine.const.BEFORE = 1¶
Used with clear functions.
If supplied, the clear function will clear everything before the cursor.
Seealso: screen.clear(), line.clear()
palpatine.cursor module¶
- palpatine.cursor.down(y=1, bol=False)[source]¶
Move the cursor down y lines.
If bol is set to True, the cursor will be put to the beginning of line. Otherwise it will maintain its current x position.
- palpatine.cursor.hide()[source]¶
Hide the cursor from screen.
The cursor is still available, just not drawn.
Seealso: show(), set_visible()
- palpatine.cursor.hori(value, rel=True)[source]¶
Convinience function to move the cursor horizontally.
If value is positive, the cursor will be moved to the right; negative values move the cursor to the left. If value is 0, this is a no-op. If rel is set to False, this function moves the cursor to the absolute x position of the current line.
- palpatine.cursor.set_visible(visible)[source]¶
Set the cursor’s visibility on screen.
The cursor is always available, even if it is not visible.
Seealso: show(), hide()
- palpatine.cursor.show()[source]¶
Show the cursor from screen.
Seealso: hide(), set_visible()
palpatine.line module¶
- palpatine.line.clear(clear_type=2)[source]¶
Clear part of, or all characters in the current line.
The cursor is not moved after the line is cleared. You will need to call cursor-moving functions (see cursor) to move it manually.
Parameters: clear_type – What part of the current line should be cleared. See const for a list of possible choices.
palpatine.screen module¶
- palpatine.screen.clear(clear_type=2)[source]¶
Clear a part, or all of the screen.
The cursor is not moved after the screen is cleared. You will need to call cursor-moving functions (see cursor) to move it manually.
Parameters: clear_type – What part of the screen should be cleared. See const for a list of possible choices.
palpatine.utils module¶
- palpatine.utils.init()[source]¶
Initialize Palpatine.
Call this at the start of your program to initialize Palpatine. Some monkey-patching will happen on certain systems (e.g. Windows) to make Palpatine work.
Seealso: deinit().
- palpatine.utils.deinit()[source]¶
De-initialization Palpatine.
Call this to disable Palpatine. This does not always disable Palpatine completely, but only restores some monkey-patched elements. Use it only if you run into problems with those monkey-patched things.
Seealso: init(), reinit().
- palpatine.utils.out(*params, **options)[source]¶
Outputs a ASCII escape command to console.
Palpatine works by sending ASCII escape sequences to your terminal. If you want to send your own sequences, maybe to achieve some advanced operations not covered by Palpatine, this is the function for you.
Seealso: https://en.wikipedia.org/wiki/ANSI_escape_code