PrintF (version 1.0.0)
index
PrintF.html

This package implements tools to build python package and tools.
 
>>> from PrintF import printf, ProgressBar
>>> printf("It's working !")
[+] It's working !
>>> printf("Is not working...", state="NOK")
[-] Is not working...
>>> printf("Oh no ! An exception is raised...", state="ERROR")
[!] Oh no ! An exception is raised...
>>> printf("It's running !", end="\n\n", state="INFO")
[*] It's running !
 
>>> printf("Please press enter to start the program...", start="\n", state="TODO")
 
[#] Please press enter to start the program...
>>> printf("Do you want to continue ?", pourcent=20, state="ASK"); print()
[?] Do you want to continue ?
[?] 20% |████                |
>>> printf("Step 1 OK", pourcent=20); printf("Step 2 OK", pourcent=55); print()
[+] Step 1 OK
[+] Step 2 OK
[+] 55% |███████████         |
>>> printf("Step 1 OK", pourcent=20); print(); printf("Step 2 OK", pourcent=55); print()
[+] Step 1 OK
[+] 20% |████                |
[+] Step 2 OK
[+] 55% |███████████         |
>>> printf("Step 2 OK", add_progressbar=False, pourcent=55); print()
[+] Step 2 OK
[+] 55%
>>> printf("Step 2 OK", oneline_progress=True, add_progressbar=False, pourcent=55); print()
[+] Step 2 OK 55%
>>> printf("Step 2 OK", oneline_progress=True, pourcent=55); print()
[+] Step 2 OK 55% |███████████         |
>>> import PrintF
>>> PrintF.STATES["TEST"] = ("[T]", "\x1b[37m")
>>> printf("Testing a custom state...", state="TEST")
[T] Testing a custom state...
>>> printf("Unknown", state="unknown")
[ ] Unknown
>>> custom_progress = ProgressBar("[", "]", "#", "-", 30)
>>> printf("Step 1 OK", progressbar=custom_progress, pourcent=20); print()
[+] Step 1 OK
[+] 20% [######------------------------]
>>>

 
Functions
       
printf(string: str, state: str = 'OK', pourcent: int = None, start: str = '', end: str = '\n', progressbar: PrintF.ProgressBar = <class 'PrintF.ProgressBar'>, add_progressbar: bool = True, oneline_progress: bool = False, **kwargs) -> None
This function prints formatted and colored information and progression.

 
Data
        STATES = {'ASK': ('[?]', '\x1b[36m'), 'ERROR': ('[!]', '\x1b[31m'), 'INFO': ('[*]', '\x1b[34m'), 'NOK': ('[-]', '\x1b[33m'), 'OK': ('[+]', '\x1b[32m'), 'TODO': ('[#]', '\x1b[35m')}
__all__ = ['printf', 'STATES']
__author_email__ = 'mauricelambert434@gmail.com'
__copyright__ = '\nPythonToolsKit Copyright (C) 2022 Maurice Lam...ome to redistribute it\nunder certain conditions.\n'
__description__ = '\nThis package implements tools to build python package and tools.\n'
__license__ = 'GPL-3.0 License'
__maintainer__ = 'Maurice Lambert'
__maintainer_email__ = 'mauricelambert434@gmail.com'
__url__ = 'https://github.com/mauricelambert/PythonToolsKit'

 
Author
        Maurice Lambert