PyCtrl
An easy beautiful command line interface add-on for python
Functions
main Namespace Reference

Functions

def cursorUp (val)
 
def cursorDown (val)
 
def cursorRight (val)
 
def cursorLeft (val)
 
def print_cursor_value (val, letter)
 
def setColor (val)
 
def printList (arr)
 
def hideCursor ()
 
def resetCursor ()
 
def onCharUp (cursorColor, position)
 
def onDownChar (arrL, cursorColor, position)
 
def get_input_char ()
 
def singleChoice (arr, cursorColor="Blue", textOrVal="Val")
 
def multiChoice (arr, cursorColor="Blue", textOrVal="Val", tickOrCross="T", otherColor="Green")
 

Detailed Description

@file main.py
Documentation for this module.
 
More details.

Function Documentation

def main.cursorDown (   val)
PURPOSE
 
Moves console cursor down by defined value

INPUT

val -one integer greater than zero

RETURNS

0 for success and -1 for error

Definition at line 29 of file main.py.

def main.cursorLeft (   val)
PURPOSE
 
Moves console cursor left by defined value

INPUT

val -one integer greater than zero

RETURNS

0 for success and -1 for error

Definition at line 69 of file main.py.

def main.cursorRight (   val)
PURPOSE
 
Moves console cursor right by defined value

INPUT

val -one integer greater than zero

RETURNS

0 for success and -1 for error

Definition at line 49 of file main.py.

def main.cursorUp (   val)
PURPOSE
 
Moves console cursor up by defined value

INPUT

val -one integer greater than zero

RETURNS

0 for success and -1 for error

Definition at line 9 of file main.py.

def main.get_input_char ( )
PURPOSE
 
Gets single key input from the user

INPUT

None

RETURNS

key buffer after press

Definition at line 252 of file main.py.

def main.hideCursor ( )
PURPOSE
 
Hide the console cursor.

INPUT

None

RETURNS

None

Definition at line 157 of file main.py.

def main.onCharUp (   cursorColor,
  position 
)
PURPOSE
 
@warning {This function is designed to be private, it may be used elswhere if useful hence the lack of attempt to hide}

This function sets the curson color as defined on input as well as moving the cursor up as long as the passed position is not currently greater than zero.

INPUT

cursorColor - Colors defined in setColor
position - current cursor position

RETURNS

position - new position after movement

Definition at line 192 of file main.py.

def main.onDownChar (   arrL,
  cursorColor,
  position 
)
PURPOSE
 
\warning {This function is designed to be private, it may be used elswhere if useful hence the lack of attempt to hide}

This function sets the curson color as defined on input as well as moving the cursor down as long as the passed position is not currently at the length of the passed array length.

INPUT

arrL - Length of array printed
cursorColor - Colors defined in setColor
position - current cursor position

RETURNS

position - new position after movement

Definition at line 222 of file main.py.

def main.print_cursor_value (   val,
  letter 
)
PURPOSE
 
Function designed for printing special @ref ANSI Escape Codes  "https://en.wikipedia.org/wiki/ANSI_escape_code#Terminal_input_sequences". The value and letter are concatenated to the escape character before being printed to the console.

INPUT

val - no verification and validation
letter - no verification and validation

RETURNS

None

Definition at line 89 of file main.py.

def main.printList (   arr)
PURPOSE
 
Prints array passed with one element on each line before returning.

INPUT

arr - array of strings to be printed

RETURNS

None

Definition at line 139 of file main.py.

def main.resetCursor ( )
PURPOSE
 
Resets the console cursor to on.

INPUT

None

RETURNS

None

Definition at line 174 of file main.py.

def main.setColor (   val)
PURPOSE
 
Defines the console cursor color

INPUT

val - one string from list (Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, Reset)

RETURNS

0 for success and -1 for error

Definition at line 108 of file main.py.